Module: ClientEngine::ClientsHelper
- Defined in:
- app/helpers/client_engine/clients_helper.rb
Instance Method Summary collapse
- #column_div_form ⇒ Object
- #column_div_link ⇒ Object
-
#correo(client) ⇒ Object
BEGIN ERROR EXPLANATION ######.
-
#error_explanation(object) ⇒ Object
BEGIN ERROR EXPLANATION ###.
- #error_explanation_loop ⇒ Object
- #errors_flash ⇒ Object
- #form ⇒ Object
- #input_group_addon ⇒ Object
- #input_groups ⇒ Object
- #javascript_paginate_helper ⇒ Object
- #li_message(message) ⇒ Object
- #link ⇒ Object
-
#paginate(resource, options = nil) ⇒ Object
BEGIN PAGINATE ####.
- #row ⇒ Object
-
#search_form_client(path, link_text, link_path) ⇒ Object
BEGIN SEARCH FORM CLIENTE ###.
-
#sortable(column, class_name, title = nil) ⇒ Object
BEGIN SORTABLE ###.
- #title ⇒ Object
- #title_row ⇒ Object
-
#titulo(icono, texto) ⇒ Object
BEGIN HELPER TITULO ###.
- #will_paginate_helper ⇒ Object
Instance Method Details
#column_div_form ⇒ Object
69 70 71 72 73 |
# File 'app/helpers/client_engine/clients_helper.rb', line 69 def column_div_form content_tag :div, class: 'col-xs-12 col-sm-8 col-md-8' do concat(form) end end |
#column_div_link ⇒ Object
75 76 77 78 79 |
# File 'app/helpers/client_engine/clients_helper.rb', line 75 def column_div_link content_tag :div, class:'col-xs-12 col-sm-4 col-md-4', style: 'text-align: right;' do concat(link) end end |
#correo(client) ⇒ Object
BEGIN ERROR EXPLANATION ######
172 173 174 |
# File 'app/helpers/client_engine/clients_helper.rb', line 172 def correo(client) link_to client.email , "mailto:"+client.email, target:"_top" end |
#error_explanation(object) ⇒ Object
BEGIN ERROR EXPLANATION ###
138 139 140 141 142 143 144 145 |
# File 'app/helpers/client_engine/clients_helper.rb', line 138 def error_explanation object @object = object if not object.nil? content_tag :div do concat(errors_flash) end end end |
#error_explanation_loop ⇒ Object
157 158 159 160 161 162 163 |
# File 'app/helpers/client_engine/clients_helper.rb', line 157 def error_explanation_loop content_tag :ul do @object.errors..each do || concat(()) end end end |
#errors_flash ⇒ Object
147 148 149 150 151 152 153 154 |
# File 'app/helpers/client_engine/clients_helper.rb', line 147 def errors_flash if @object.errors.any? content_tag :div, class: "alert alert-danger", role:"alert" do concat("<strong>Se produjeron los siguientes errores:</strong>".html_safe) concat(error_explanation_loop) end end end |
#form ⇒ Object
81 82 83 84 85 86 87 |
# File 'app/helpers/client_engine/clients_helper.rb', line 81 def form form_tag @path, :method => 'get', :id => "search_form", remote: true do content_tag :div, class:' form-inline' do concat( input_groups) end end end |
#input_group_addon ⇒ Object
105 106 107 108 109 |
# File 'app/helpers/client_engine/clients_helper.rb', line 105 def input_group_addon content_tag :div, class: 'input-group-addon' do concat(content_tag :span,'', class:'glyphicon glyphicon-search', aria:{hidden:'true'}) end end |
#input_groups ⇒ Object
97 98 99 100 101 102 103 |
# File 'app/helpers/client_engine/clients_helper.rb', line 97 def input_groups content_tag :div, class:'input-group' do concat(content_tag :div, 'Buscar', class:'input-group-addon') concat(text_field_tag :search, params[:search], class: 'form-control', size: 50, onkeyup: 'remoteSubmit("#search_form");', autofocus: true ) concat(input_group_addon) end end |
#javascript_paginate_helper ⇒ Object
132 133 134 |
# File 'app/helpers/client_engine/clients_helper.rb', line 132 def javascript_paginate_helper javascript_tag("$('ul.pagination a').click(function(){$.getScript(this.href); return false; });") end |
#li_message(message) ⇒ Object
165 166 167 168 169 |
# File 'app/helpers/client_engine/clients_helper.rb', line 165 def content_tag :li do "#{}" end end |
#link ⇒ Object
89 90 91 92 93 94 95 |
# File 'app/helpers/client_engine/clients_helper.rb', line 89 def link if !@link_path.nil? && @modal_id.nil? link_to "#{fa_icon('plus')} #{@link_text}".html_safe, @link_path, class:'btn btn-primary full-btn margin-btn' elsif !@link_path.nil? && !@modal_id.nil? link_to "#{fa_icon('plus')} #{@link_text}".html_safe, @link_path, class:'btn btn-primary full-btn margin-btn', remote: true, "data-toggle" => "modal", "data-target" => @modal_id end end |
#paginate(resource, options = nil) ⇒ Object
BEGIN PAGINATE ####
114 115 116 117 118 119 120 121 122 |
# File 'app/helpers/client_engine/clients_helper.rb', line 114 def paginate resource, = nil if not @resource = resource content_tag :div, style: 'text-align: center;' do concat(will_paginate_helper) concat(javascript_paginate_helper) end end end |
#row ⇒ Object
62 63 64 65 66 67 |
# File 'app/helpers/client_engine/clients_helper.rb', line 62 def row content_tag :div, class: 'row' do concat(column_div_form) concat(column_div_link) end end |
#search_form_client(path, link_text, link_path) ⇒ Object
BEGIN SEARCH FORM CLIENTE ###
52 53 54 55 56 57 58 59 60 |
# File 'app/helpers/client_engine/clients_helper.rb', line 52 def search_form_client path, link_text, link_path @path = path @link_text = link_text @link_path = link_path content_tag :div, id:'buscador' do concat(row) end end |
#sortable(column, class_name, title = nil) ⇒ Object
BEGIN SORTABLE ###
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/client_engine/clients_helper.rb', line 5 def sortable(column,class_name, title = nil) title ||= column.titleize if column.split(".").count >= 2 css_class = ( (column.split(".").last.to_s == sort_column(class_name).split(".").last.to_s) && (column.split(".").last(2).first.pluralize.to_s == sort_column(class_name).split(".").last(2).first.pluralize.to_s) ) ? "#{sort_direction}" : nil css_class = css_class == "asc" ? "long-arrow-down" : (css_class == "desc" ? "long-arrow-up" : nil) else css_class = column.split(".").last.to_s == sort_column(class_name).split(".").last.to_s ? "#{sort_direction}" : nil css_class = css_class == "asc" ? "long-arrow-down" : (css_class == "desc" ? "long-arrow-up" : nil) end column.split(".").to_s sort_column(class_name).split(".").to_s css_class direction = (column.split(".").last.to_s == sort_column(class_name).split(".").last.to_s && sort_direction == "asc") ? "desc" : "asc" link_to "#{fa_icon(css_class)} #{title}".html_safe, {sort: column, direction: direction, search: params[:search]}, {remote: true} end |
#title ⇒ Object
43 44 45 46 47 48 |
# File 'app/helpers/client_engine/clients_helper.rb', line 43 def title content_tag :h1 do concat(fa_icon(@icono)) concat(" " + @texto) end end |
#title_row ⇒ Object
37 38 39 40 41 |
# File 'app/helpers/client_engine/clients_helper.rb', line 37 def title_row content_tag :div,class:'col-xs-10 col-sm-11 col-md-11' do concat(title) end end |
#titulo(icono, texto) ⇒ Object
BEGIN HELPER TITULO ###
27 28 29 30 31 32 33 34 35 |
# File 'app/helpers/client_engine/clients_helper.rb', line 27 def titulo icono,texto @icono = icono @texto = texto content_for :title do content_tag :div, class: :row do concat(title_row) end end end |
#will_paginate_helper ⇒ Object
123 124 125 126 127 128 129 130 |
# File 'app/helpers/client_engine/clients_helper.rb', line 123 def will_paginate_helper will_paginate @resource, :page_links => true, :inner_window => 1, :outer_window => 1, :previous_label => '← Anterior', :next_label => 'Siguiente →', renderer: BootstrapPagination::Rails end |