Module: LoldesignPublisher::PublisherHelper
- Defined in:
- app/helpers/loldesign_publisher/publisher_helper.rb
Instance Method Summary collapse
- #activable_field_for(resource, options = {}) ⇒ Object
- #add_resource(text, path) ⇒ Object
- #cancel_action(options = {}) ⇒ Object
- #default_button(text, path = 'javascript://') ⇒ Object
- #display_list_for(resources, options = {}) ⇒ Object
- #edit_resource(path) ⇒ Object
- #gumby_icon(icon_name) ⇒ Object
- #nav_main_link(key) ⇒ Object
- #remove_resource(path, options = {}) ⇒ Object
- #save_resource(text, path) ⇒ Object
- #show_resource(text, path) ⇒ Object
- #show_resource_with_icon(path) ⇒ Object
- #submit_button(form, text = 'Salvar') ⇒ Object
- #title_page(title, options = {}) ⇒ Object
Instance Method Details
#activable_field_for(resource, options = {}) ⇒ Object
92 93 94 95 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 92 def activable_field_for(resource, ={}) klass = [:klass] || resource.class.to_s check_box_tag resource, :active, resource.active, data: {resource: klass, id: resource.id}, class: 'activable' end |
#add_resource(text, path) ⇒ Object
17 18 19 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 17 def add_resource(text, path) render partial: '/layouts/loldesign_publisher/modules/add_resource', locals: {text: text, path: path} end |
#cancel_action(options = {}) ⇒ Object
43 44 45 46 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 43 def cancel_action(={}) path = [:path] || 'javascript://' ('Cancelar', path) end |
#default_button(text, path = 'javascript://') ⇒ Object
48 49 50 51 52 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 48 def (text, path='javascript://') content_tag :div, class: 'pretty medium info btn cancel' do link_to text, path end end |
#display_list_for(resources, options = {}) ⇒ Object
86 87 88 89 90 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 86 def display_list_for(resources, ={}) total_fields = [:fields] || 2 render(resources) || render(partial: '/layouts/loldesign_publisher/modules/td_not_found', locals: {colspan: total_fields}) end |
#edit_resource(path) ⇒ Object
21 22 23 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 21 def edit_resource(path) link_to(path) { gumby_icon 'pencil' } end |
#gumby_icon(icon_name) ⇒ Object
97 98 99 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 97 def gumby_icon(icon_name) content_tag :i, '', class: "icon-#{icon_name}" end |
#nav_main_link(key) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 72 def nav_main_link(key) link_name = LoldesignPublisher.config[:menu_links][key]['name'] if LoldesignPublisher.config[:menu_links][key]['path'].present? link_path = send(LoldesignPublisher.config[:menu_links][key]['path']) = {data: {active: controller_name == key}} else link_path = 'javascript://' = {} end link_to link_name, link_path, end |
#remove_resource(path, options = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 29 def remove_resource(path, ={}) = [:message] || 'Você tem certeza que deseja remover?' type = [:type] || :link text = [:text] || 'Remover' if type == :link link_to(path, method: :delete, data: {confirm: }) { gumby_icon 'cancel-circled' } else content_tag :div, class: 'pretty medium danger btn remove' do link_to text, path, method: :delete, data: {confirm: } end end end |
#save_resource(text, path) ⇒ Object
54 55 56 57 58 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 54 def save_resource(text, path) content_tag :div, class: 'pretty medium secondary btn save' do link_to text, path, data: {disable_with: '...'} end end |
#show_resource(text, path) ⇒ Object
66 67 68 69 70 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 66 def show_resource(text, path) content_tag :div, class: 'pretty medium default btn show' do link_to text, path end end |
#show_resource_with_icon(path) ⇒ Object
25 26 27 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 25 def show_resource_with_icon(path) link_to(path){ gumby_icon 'info-circled' } end |
#submit_button(form, text = 'Salvar') ⇒ Object
60 61 62 63 64 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 60 def (form, text='Salvar') content_tag :div, class: 'pretty medium secondary btn save' do form.submit text, data: {'disable-with' => '...'} end end |
#title_page(title, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/helpers/loldesign_publisher/publisher_helper.rb', line 5 def title_page(title, ={}) = {display: [:save].present? , path: [:save] || 'javascript://'} = {display: [:show].present? , path: [:show] || 'javascript://'} = {display: [:subtitle].present?, text: [:subtitle] || '' } render partial: '/layouts/loldesign_publisher/modules/title_page', locals: {title: title, show_options: , save_options: , subtitle_options: } end |