bootswatch_rails 3.2.0.10 → 3.2.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60232bc73b47d3b4656dd3498d9bdcdf5bbb9fa6
4
- data.tar.gz: df80d969c88617677b7f5cb07ebfca77e11ca21c
3
+ metadata.gz: d5c6154711bbb92cd3ebe2aab4d6c05ec7429918
4
+ data.tar.gz: 5be253e8c04f076e177fa0b45c9ff35040cb8100
5
5
  SHA512:
6
- metadata.gz: 90a3a2da7c4633b33988d8f389333b6c43fa7e0bb5d0376e215317ff784d25ba83b998f4031766a63b8d410536696bae0ff0c227be209c2b21f066000293ce33
7
- data.tar.gz: 6b90ff94b904769f85eaab1a291f9ef5144b0f84466dae57091ecfed90908b76380d0b1ac0513a81d6141d620b382a36a305f36ab0c9a497b9838a15950ca271
6
+ metadata.gz: 27b4412d15686c3d171b7a24ba1fca046cc8db835a969082dc743371afd7cfe170fa3678f922d172b0057f1ef137652496d06bbb95e755f1e7f6402077f802f2
7
+ data.tar.gz: b547102e9fc4420e8218718f4e145162af116be51d493162b5d1516897b5462fea7878b05f5d2e7eeb5d5142dac6d63ddc0aa478584d7eb31d0878e7e381dcd9
data/Makefile CHANGED
@@ -3,12 +3,18 @@
3
3
  # Makefile for building the Gem
4
4
  #
5
5
 
6
- all:
6
+ all: build
7
+ vim lib/bootswatch_rails/version.rb
8
+ git commit -a
9
+ rake release
10
+
11
+ install: build
12
+ git commit -a
13
+ sudo rake install
14
+
15
+ build:
7
16
  ./generate.sh
8
17
  test -d cleditor && git add cleditor || true
9
18
  git add lib
10
19
  git add vendor
11
- vim lib/bootswatch_rails/version.rb
12
- git commit -a
13
- rake release
14
20
 
@@ -1,5 +1,5 @@
1
1
  module BootswatchRails
2
- VERSION = "3.2.0.10"
2
+ VERSION = "3.2.0.11"
3
3
  THEMES = [:amelia, :cerulean, :cosmo, :custom, :cyborg, :darkly, :flatly, :journal, :lumen, :paper, :readable, :sandstone, :simplex, :slate, :spacelab, :superhero, :united, :yeti]
4
4
  DEFAULT = 1
5
5
  end
@@ -18,7 +18,7 @@ module BootswatchRails
18
18
  end
19
19
 
20
20
  def add_helper
21
- copy_file "created_by_helper.rb", "app/helpers/created_by_helper.rb"
21
+ template "created_by_helper.rb", "app/helpers/created_by_helper.rb"
22
22
  end
23
23
 
24
24
  def update_controller
@@ -1,14 +1,30 @@
1
1
  module CreatedByHelper
2
- def text_created_by(model, mode = "create", full = true)
2
+ def text_created_by(model, action = "create", mode = "short")
3
3
  begin
4
- id = model.send("#{mode}d_by")
5
- day = model.send("#{mode}d_at").to_date
6
- user = User.find(id)
4
+ if action.include?("update")
5
+ id = model.updated_by
6
+ time = model.updated_at
7
+ else
8
+ id = model.created_by
9
+ time = model.created_at
10
+ end
11
+ user = <%= user.camelize %>.find(id)
7
12
  name = user.name
13
+ email = user.email
8
14
  rescue
9
- return "???"
15
+ return ""
16
+ end
17
+ case mode
18
+ when "name"
19
+ name
20
+ when "email"
21
+ email
22
+ when "user"
23
+ mail_to(email, name)
24
+ when "long"
25
+ "#{mail_to(email, name)} (#{l(time)})"
26
+ else
27
+ "#{mail_to(email, name)} (#{l(time.to_date)})"
10
28
  end
11
- return name unless full
12
- "#{mail_to(user.email, name)} (#{l(day)})"
13
29
  end
14
30
  end
@@ -2,6 +2,7 @@
2
2
  <%%= f.error_notification %>
3
3
 
4
4
  <%- attributes.each do |attribute| -%>
5
+ <%- next if [ "created_by", "updated_by" ].include? attribute.name -%>
5
6
  <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
6
7
  <%- if attribute.name.include?("picture") -%>
7
8
  <%%= f.input :<%= attribute.name %>_cache, as: :hidden %>
@@ -4,9 +4,17 @@
4
4
  <thead>
5
5
  <tr>
6
6
  <% attributes.each do |attribute| -%>
7
- <th><%%= t('activerecord.attributes.<%= singular_table_name %>.<%= attribute.name %>') %></th>
7
+ <th>
8
+ <%- if [ "created_by", "updated_by" ].include? attribute.name -%>
9
+ <%%= t('activerecord.attributes.<%= attribute.name %>') %>
10
+ <%- else -%>
11
+ <%%= t('activerecord.attributes.<%= singular_table_name %>.<%= attribute.name %>') %>
12
+ <%- end -%>
13
+ </th>
8
14
  <% end -%>
9
- <th class="index-actions"><%%= t('actions.title') %></th>
15
+ <th class="index-actions">
16
+ <%%= t('actions.title') %>
17
+ </th>
10
18
  </tr>
11
19
  </thead>
12
20
 
@@ -21,6 +29,10 @@
21
29
  <%%= <%= singular_table_name %>.<%= attribute.name %> ? t('simple_form.yes') : t('simple_form.no') %>
22
30
  <%- elsif attribute.type == :belongs_to -%>
23
31
  <%%= <%= singular_table_name %>.<%= attribute.name %>.name %>
32
+ <%- elsif attribute.name == "created_by" -%>
33
+ <%%= raw(text_created_by(<%= singular_table_name %>, "create")) %>
34
+ <%- elsif attribute.name == "updated_by" -%>
35
+ <%%= raw(text_created_by(<%= singular_table_name %>, "update")) %>
24
36
  <%- else -%>
25
37
  <%%= <%= singular_table_name %>.<%= attribute.name %> %>
26
38
  <%- end -%>
@@ -5,7 +5,11 @@
5
5
  <% attributes.each do |attribute| -%>
6
6
  <tr>
7
7
  <td>
8
+ <%- if [ "created_by", "updated_by" ].include? attribute.name -%>
9
+ <%%= t('activerecord.attributes.<%= attribute.name %>') %>
10
+ <%- else -%>
8
11
  <%%= t('activerecord.attributes.<%= singular_table_name %>.<%= attribute.name %>') %>
12
+ <%- end -%>
9
13
  </td>
10
14
  <td>
11
15
  <%- if attribute.name.include?("picture") -%>
@@ -17,6 +21,10 @@
17
21
  <%%= @<%= singular_table_name %>.<%= attribute.name %> ? t('simple_form.yes') : t('simple_form.no') %>
18
22
  <%- elsif attribute.type == :belongs_to -%>
19
23
  <%%= @<%= singular_table_name %>.<%= attribute.name %>.name %>
24
+ <%- elsif attribute.name == "created_by" -%>
25
+ <%%= raw(text_created_by(@<%= singular_table_name %>, "create")) %>
26
+ <%- elsif attribute.name == "updated_by" -%>
27
+ <%%= raw(text_created_by(@<%= singular_table_name %>, "update")) %>
20
28
  <%- else -%>
21
29
  <%%= @<%= singular_table_name %>.<%= attribute.name %> %>
22
30
  <%- end -%>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootswatch_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0.10
4
+ version: 3.2.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volker Wiegand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-21 00:00:00.000000000 Z
11
+ date: 2014-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties