snaptable 0.8.6 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df5de2ef7546d0239eede95d41de5cae8a2f033e
4
- data.tar.gz: 08ae93ee6ffc8e9535b686de71ddd80dbe3bcc82
3
+ metadata.gz: 11ed98f7d34d0a9958c2b3e8ecebb97f6d96ae41
4
+ data.tar.gz: fadc6c8bb2d6968709836de1849a1fce7a6a68a9
5
5
  SHA512:
6
- metadata.gz: 874ce743885387be79bfe779a82645caccf880ccbf19e45583f253df212233d646099f51d617132c31f0cc902cf4d394bf52fa93f922c3121c1423fb50a7dc14
7
- data.tar.gz: 0f8aaaff1bd93b04bc9d4f81519e6250d328af105c0d8b6908f183aeaf8a46cdee58ece8149864e30992546d7496d98cb9b31ab0794b4674d1a475671e055615
6
+ metadata.gz: 8c7cd73a2c802bb2942e98ef8ac162267d47957c65c0b35acafdffe5b8aa4473f6dd4a53c3f03ebdfaa1327d39b58a448428498296151260ff55a847ef916725
7
+ data.tar.gz: 6d1927814485082fe9d1d45a2aff6aecb7fe9ed148a9df07efa87406e4812f2182f26e79fff3fee382d8e11cbd37ced29090be503e3d9bb3a88064ad72f16d29
@@ -1,20 +1,18 @@
1
- <div class="table_buttons">
2
- <p><%= t("table.buttons.title") %></p>
3
- <p>
4
- <% if add_button? %>
5
- <%= link_to t("table.buttons.add"), request.path + "/new", class: "add" %>
6
- <% end %>
7
- <% if edit_button? %>
8
- <a class="edit" href="#"><%= t("table.buttons.edit") %></a>
9
- <% end %>
10
- <% if show_button? %>
11
- <a class="show" href="#"><%= t("table.buttons.show") %></a>
12
- <% end %>
13
- <% if delete_button? %>
14
- <a class="delete" href="#" data-method="delete"
15
- rel="nofollow" data-confirm="Etes-vous sûr de vouloir supprimer cette entrée ?">
16
- <%= t("table.buttons.delete") %>
17
- </a>
18
- <% end %>
19
- </p>
20
- </div>
1
+ <p><%= t("table.buttons.title") %></p>
2
+ <p>
3
+ <% if add_button? %>
4
+ <%= link_to t("table.buttons.add"), request.path + "/new", class: "add" %>
5
+ <% end %>
6
+ <% if edit_button? %>
7
+ <a class="edit" href="#"><%= t("table.buttons.edit") %></a>
8
+ <% end %>
9
+ <% if show_button? %>
10
+ <a class="show" href="#"><%= t("table.buttons.show") %></a>
11
+ <% end %>
12
+ <% if delete_button? %>
13
+ <a class="delete" href="#" data-method="delete"
14
+ rel="nofollow" data-confirm="Etes-vous sûr de vouloir supprimer cette entrée ?">
15
+ <%= t("table.buttons.delete") %>
16
+ </a>
17
+ <% end %>
18
+ </p>
@@ -1,13 +1,10 @@
1
1
  <div id="snaptable">
2
2
  <%= render 'snaptable/search_field' if presenter.options[:search] == true %>
3
- <%= render 'snaptable/buttons' unless presenter.options[:buttons] == false %>
4
-
5
- <% if buttons %>
6
- <div class="table_buttons">
7
- <%= render buttons if buttons %>
8
- </div>
9
- <% end %>
10
3
 
4
+ <div class="table_buttons">
5
+ <%= render presenter.instance_variable_get(:@buttons) unless presenter.options[:buttons] == false %>
6
+ </div>
7
+
11
8
  <table>
12
9
  <thead>
13
10
  <tr>
@@ -1,2 +1,3 @@
1
- $('#snaptable').replaceWith('<%= j @table.present %>') ;
1
+ var snaptable = $("#snaptable");
2
+ snaptable.replaceWith('<%= j @table.present(buttons: params[:partial]) %>');
2
3
  snapifyTable();
@@ -8,7 +8,7 @@ en:
8
8
  table:
9
9
  nothing: "Nothing to display"
10
10
  search:
11
- title: "Seach"
11
+ title: "Search"
12
12
  submit: "Search"
13
13
  buttons:
14
14
  title: "Actions"
@@ -3,7 +3,8 @@ module Snaptable
3
3
  module Renderer
4
4
 
5
5
  def present(buttons: nil)
6
- render_to_string('/snaptable/base', layout: false, locals: { presenter: self, buttons: buttons}).html_safe
6
+ @buttons = buttons || "snaptable/buttons"
7
+ render_to_string('/snaptable/base', layout: false, locals: { presenter: self }).html_safe
7
8
  end
8
9
 
9
10
  def respond
@@ -4,7 +4,7 @@ module Snaptable
4
4
 
5
5
  def sortable(column)
6
6
  if model.reflect_on_association(column.gsub /_id/, '').nil?
7
- view_context.link_to({sort: column, direction: direction(column), query: params[:query], page: page}, {remote: true, class: css_class(column)}) do
7
+ view_context.link_to({sort: column, direction: direction(column), query: params[:query], page: page, partial: @buttons}, {remote: true, class: css_class(column)}) do
8
8
  model.human_attribute_name(column)
9
9
  end
10
10
  else
@@ -8,9 +8,5 @@ module Snaptable
8
8
  initializer 'Snaptable.tables' do
9
9
  ActionController::Base.send :include, Helpers
10
10
  end
11
-
12
- initializer 'Snaptable.buttons_helper' do
13
- ActionView::Base.send(:include, ButtonsHelper)
14
- end
15
11
  end
16
12
  end
@@ -1,3 +1,3 @@
1
1
  module Snaptable
2
- VERSION = "0.8.6"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - khcr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-27 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails