Description:
* add button size option to toggle_button helper
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r563:589243c81dda - - 2 files changed: 7 inserted, 6 deleted
@@ -107,11 +107,12 | |||
|
107 | 107 | end |
|
108 | 108 | end |
|
109 | 109 | |
|
110 | - def toggle_button(on,toggle_url,id) | |
|
111 | - link_to (on ? "Yes" : "No"), toggle_url, | |
|
112 | - {class: "btn btn-block btn-xs btn-#{on ? 'success' : 'default'} ajax-toggle", | |
|
113 | - id: id, | |
|
114 | - data: {remote: true, method: 'get'}} | |
|
110 | + def toggle_button(on,toggle_url,id, option={}) | |
|
111 | + btn_size = option[:size] || 'btn-xs' | |
|
112 | + link_to (on ? "Yes" : "No"), toggle_url, | |
|
113 | + {class: "btn btn-block #{btn_size} btn-#{on ? 'success' : 'default'} ajax-toggle", | |
|
114 | + id: id, | |
|
115 | + data: {remote: true, method: 'get'}} | |
|
115 | 116 | end |
|
116 | 117 | |
|
117 | 118 | def user_title_bar(user) |
@@ -27,7 +27,7 | |||
|
27 | 27 | %br/ |
|
28 | 28 | = h announcement.body |
|
29 | 29 | %td= h announcement.author |
|
30 | - %td= toggle_button(announcement.published?, toggle_announcement_url(@announcement), "announcement_toggle_#{@announcement.id}") | |
|
30 | + %td= toggle_button(announcement.published?, toggle_announcement_url(@announcement), "announcement_toggle_#{@announcement.id}", {size: 'btn-sm'}) | |
|
31 | 31 | //%td= link_to (announcement.published? ? "Yes" : "No"), url_for(controller: :announcements, action: :toggle, id: announcement), { class: "btn btn-block btn-sm btn-#{(announcement.published? ? 'success' : 'default')} ajax-toggle", id: "published-#{announcement.id}", data: {remote: true, method: 'post' } } |
|
32 | 32 | %td= link_to 'Edit', edit_announcement_path(announcement), class: 'btn btn-block btn-sm btn-info' |
|
33 | 33 | %td= link_to 'Destroy', announcement, :confirm => 'Are you sure?', :method => :delete, class: "btn btn-block btn-sm btn-danger" |
You need to be logged in to leave comments.
Login now