Class: TodoListItem

Inherits:
Object
  • Object
show all
Includes:
Glimmer::Web::Component
Defined in:
lib/glimmer-dsl-web/samples/regular/todo_mvc/views/todo_list_item.rb

Instance Attribute Summary

Attributes included from Glimmer::Web::Component

#args, #markup_root, #options, #parent

Instance Method Summary collapse

Methods included from Glimmer::Web::Component

add_component_namespaces_for, #add_observer, #attribute_setter, #can_add_observer?, #can_handle_observation_request?, component_namespaces, #content, for, #get_attribute, #handle_observation_request, #has_attribute?, #has_instance_method?, included, #initialize, interpretation_stack, #local_respond_to?, #method_missing, namespaces_for_class, #observer_registrations, #post_add_content, #post_initialize_child, #render, reset_component_namespaces, #respond_to_missing?, #set_attribute

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Glimmer::Web::Component

Instance Method Details

#li_class_name(todo) ⇒ Object



50
51
52
53
54
55
# File 'lib/glimmer-dsl-web/samples/regular/todo_mvc/views/todo_list_item.rb', line 50

def li_class_name(todo)
  classes = []
  classes << 'completed' if todo.completed?
  classes << 'editing' if todo.editing?
  classes.join(' ')
end

#todo_list_item_stylesObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/glimmer-dsl-web/samples/regular/todo_mvc/views/todo_list_item.rb', line 57

def todo_list_item_styles
  rule('.todo-list li.completed label') {
    color '#949494'
    text_decoration 'line-through'
  }
  
  rule('.todo-list li') {
    border_bottom '1px solid #ededed'
    font_size '24px'
    position 'relative'
  }
  
  rule('.todo-list li .toggle') {
    _webkit_appearance 'none'
    appearance 'none'
    border 'none'
    bottom '0'
    height 'auto'
    margin 'auto 0'
    opacity '0'
    position 'absolute'
    text_align 'center'
    top '0'
    width '40px'
  }
  
  rule('.todo-list li label') {
    color '#484848'
    display 'block'
    font_weight '400'
    line_height '1.2'
    min_height '40px'
    padding '15px 15px 15px 60px'
    transition 'color .4s'
    word_break 'break-all'
  }
  
  rule('.todo-list li .toggle+label') {
    background_image 'url(data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23949494%22%20stroke-width%3D%223%22/%3E%3C/svg%3E)'
    background_position '0'
    background_repeat 'no-repeat'
  }
  
  rule('.todo-list li.completed label') {
    color '#949494'
    text_decoration 'line-through'
  }
  
  rule('.todo-list li .toggle:checked+label') {
    background_image 'url(data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%2359A193%22%20stroke-width%3D%223%22%2F%3E%3Cpath%20fill%3D%22%233EA390%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22%2F%3E%3C%2Fsvg%3E)'
  }
  
  rule('.todo-list li.editing') {
    border_bottom 'none'
    padding '0'
  }
  
  rule('.todo-list li.editing input[type=checkbox], .todo-list li.editing label') {
    opacity '0'
  }
  
  rule('.todo-list li .destroy') {
    bottom '0'
    color '#949494'
    display 'none'
    font_size '30px'
    height '40px'
    margin 'auto 0'
    position 'absolute'
    right '10px'
    top '0'
    transition 'color .2s ease-out'
    width '40px'
  }
  
  rule('.todo-list li:focus .destroy, .todo-list li:hover .destroy') {
    display 'block'
  }
  
  rule('.todo-list li .destroy:focus, .todo-list li .destroy:hover') {
    color '#c18585'
  }
  
  rule('.todo-list li .destroy:after') {
    content '"×"'
    display 'block'
    height '100%'
    line_height '1.1'
  }
  
  media ('screen and (-webkit-min-device-pixel-ratio: 0)') {
    rule('.todo-list li .toggle, .toggle-all') {
      background 'none'
    }
    
    rule('.todo-list li .toggle') {
      height '40px'
    }
  }
end