This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Source: https://github.com/AndyObtiva/glimmer-dsl-web/blob/master/lib/glimmer-dsl-web/samples/regular/todo_mvc/models/todo.rb | |
| Todo = Struct.new(:task, :completed, :editing, keyword_init: true) do | |
| class << self | |
| attr_writer :all | |
| def all | |
| @all ||= [] | |
| end | |
| def active |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Source: https://github.com/AndyObtiva/glimmer-dsl-web/blob/master/lib/glimmer-dsl-web/samples/regular/todo_mvc/presenters/todo_presenter.rb | |
| require 'glimmer/data_binding/observer' | |
| require_relative '../models/todo' | |
| class TodoPresenter | |
| FILTER_ROUTE_REGEXP = /\#\/([^\/]*)$/ | |
| attr_accessor :todos, :can_clear_completed, :active_todo_count | |
| attr_reader :new_todo, :filter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Source: https://github.com/AndyObtiva/glimmer-dsl-web/blob/master/lib/glimmer-dsl-web/samples/regular/todo_mvc/views/edit_todo_input.rb | |
| require_relative 'todo_input' | |
| class EditTodoInput < TodoInput | |
| option :presenter | |
| option :todo | |
| markup { | |
| input(class: todo_input_class) { |edit_input| | |
| # Data-bind `input` `style` property unidirectionally to `todo` `editing` attribute, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Source: https://github.com/AndyObtiva/glimmer-dsl-web/blob/master/lib/glimmer-dsl-web/samples/regular/todo_mvc/views/todo_list_item.rb | |
| require_relative 'edit_todo_input' | |
| class TodoListItem | |
| include Glimmer::Web::Component | |
| option :presenter | |
| option :todo | |
| markup { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Source: https://github.com/AndyObtiva/glimmer-dsl-web/blob/master/lib/glimmer-dsl-web/samples/regular/todo_mvc/views/todo_list.rb | |
| require_relative 'todo_list_item' | |
| class TodoList | |
| include Glimmer::Web::Component | |
| option :presenter | |
| markup { | |
| main(class: 'main') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Source: https://github.com/AndyObtiva/glimmer-dsl-web/blob/master/lib/glimmer-dsl-web/samples/regular/todo_mvc/views/todo_input.rb | |
| # Superclass for NewTodoInput and EditTodoInput with common styles | |
| class TodoInput | |
| include Glimmer::Web::Component | |
| def todo_input_class | |
| 'todo-input' | |
| end | |
| def todo_input_styles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Source: https://github.com/AndyObtiva/glimmer-dsl-web/blob/master/lib/glimmer-dsl-web/samples/regular/todo_mvc/views/new_todo_input.rb | |
| require_relative 'todo_input' | |
| class NewTodoInput < TodoInput | |
| option :presenter | |
| markup { | |
| input(class: todo_input_class, placeholder: "What needs to be done?", autofocus: "") { | |
| # Data-bind `input` `value` property bidirectionally to `presenter.new_todo` `task` attribute | |
| # meaning make any changes to the new todo task automatically update the input value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Source: https://github.com/AndyObtiva/glimmer-dsl-web/blob/master/lib/glimmer-dsl-web/samples/regular/todo_mvc/views/new_todo_form.rb | |
| require_relative 'new_todo_input' | |
| class NewTodoForm | |
| include Glimmer::Web::Component | |
| option :presenter | |
| markup { | |
| header(class: 'header') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Source: https://github.com/AndyObtiva/glimmer-dsl-web/blob/master/lib/glimmer-dsl-web/samples/regular/todo_mvc.rb | |
| require 'glimmer-dsl-web' | |
| require_relative 'todo_mvc/presenters/todo_presenter' | |
| require_relative 'todo_mvc/views/new_todo_form' | |
| require_relative 'todo_mvc/views/todo_list' | |
| require_relative 'todo_mvc/views/todo_filters' | |
| require_relative 'todo_mvc/views/todo_mvc_footer' |