Giter VIP home page Giter VIP logo

Comments (8)

mshriver avatar mshriver commented on August 16, 2024

Coverage for registering a 'default' or 'else' value against form_remainder?

from widgetastic.core.

mfalesni avatar mfalesni commented on August 16, 2024

@mshriver Hmm, good catch, that will also need care. I think it could generate an empty form if not specified, otherwise you can use "form_remainder.register_default" or something like that.

from widgetastic.core.

izapolsk avatar izapolsk commented on August 16, 2024

@mfalesni, @mshriver,

Are you ok if such conditional views will be implemented in the following way:

class SomeView(View):
	master_widget = SomeWidget()

	@View.conditional(condition=master_widget.text == 'SomeValue', alias='CommonName')
	class SlaveView1(View):
            pass

	@View.conditional(condition=master_widget.text == 'AnotherValue', alias='CommonName')
	class SlaveView2(View):
            pass

	@View.conditional(condition='default', alias='CommonName')
	class SlaveView3(View):
            pass

from widgetastic.core.

mfalesni avatar mfalesni commented on August 16, 2024

The confition= syntax would not be as simple, it would have to be a lambda (to process the value and say bool) or a value to be compared. What would be the use for alias= ?

from widgetastic.core.

izapolsk avatar izapolsk commented on August 16, 2024

yes, syntax is likely to be slightly changed during implementation.
Alias will allow us to use one name for several views.
When I was writing this code sample I had in mind Add Infra Provider dialog. Where second part of dialog is opened after provide type is chosen.

from widgetastic.core.

mfalesni avatar mfalesni commented on August 16, 2024

The solution I am thinking about and will be simplest is this one:

view.fill({
  'provider_name': 'foo'
  'provider_type': 'bar',
  'provider_data': { ... },
})

Where provider_data will be a widget that will switch underlying views based on a condition (so the nesting is obligatory). I was also thinking about "including" some views, even conditionally, but that will be more difficult to master.

from widgetastic.core.

izapolsk avatar izapolsk commented on August 16, 2024

@mfalesni , could you please give me few real world examples of where such switchable views can be used then ?

from widgetastic.core.

mfalesni avatar mfalesni commented on August 16, 2024

Control Actions let's say. Anywhere where something reveals a form different for each value ...

from widgetastic.core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.