magic_locales 0.0.2 → 0.0.3
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 +4 -4
- data/lib/app/controllers/magic_locales/base_controller.rb +1 -1
- data/lib/app/models/magic_locales/language.rb +1 -1
- data/lib/app/views/magic_locales/_admin_template.html.erb +14 -0
- data/lib/app/views/magic_locales/locales/index.html.erb +75 -82
- data/lib/generators/magic_locales/templates/magic_initializer.rb +13 -0
- data/lib/magic_locales/flag_helper.rb +4 -0
- data/lib/magic_locales/version.rb +1 -1
- data/spec/dummy/log/development.log +82 -0
- metadata +5 -5
- data/spec/dummy/tmp/pids/server.pid +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b240730bde2e5402f6febd662ded9085dd60a82e
|
4
|
+
data.tar.gz: 112c5099a082110cc3268fafd08291ea9654595b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d995cc641ac92fb1afe1a16bc6db5147a0487b2e641bb42f3b646955ecf26c7f45b8fa8473ba53e1feb30e9e9b41192f020cc1aad568ece68e029179c8542c82
|
7
|
+
data.tar.gz: e1e90dfd31c892b6ab55b5e1b85f870c4b06fc206cbea9175078f2d5ffaaf1960917330af615d01ebb2c8bffd602d965afa336ddfd16d7a4fc88fde49dfa5c70
|
@@ -8,7 +8,7 @@ class MagicLocales::Language < ActiveRecord::Base
|
|
8
8
|
LEVELS = %w(basic medium advanced excelent) # => and 'native'
|
9
9
|
|
10
10
|
# =====> A S S O Z I A T I O N S <========================================================= #
|
11
|
-
belongs_to :
|
11
|
+
belongs_to :owner, polymorphic: true
|
12
12
|
belongs_to :locale, class_name: "Wizard::Locale", foreign_key: :locale_id
|
13
13
|
|
14
14
|
|
@@ -1,83 +1,76 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
<%= magic_locaoles_admin_template do %>
|
2
|
+
|
3
|
+
<%= content_for :headline do %>
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
<br/>
|
79
|
-
<br/>
|
80
|
-
|
81
|
-
</div>
|
82
|
-
</div>
|
83
|
-
<%# end %>
|
5
|
+
<%= link_to "New Locale", url_for( controller: "magic_locales/locales", action: :new), class: "btn btn-success pull-right btn-sm", data: { toggle: "modal", target: "#appModal" } %>
|
6
|
+
<i class="magicons-user-group-round"></i> <%= t("activerecord.attributes.wizard_locale.other") %>
|
7
|
+
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
|
11
|
+
<h4>
|
12
|
+
<strong>Available Locales:</strong>
|
13
|
+
<% I18n.available_locales.each do |al| %>
|
14
|
+
<span class="label label-default"><%= al %></span>
|
15
|
+
<% end %>
|
16
|
+
</h4>
|
17
|
+
<div class="clearfix"></div>
|
18
|
+
<hr/>
|
19
|
+
<table class="table table-striped">
|
20
|
+
<thead>
|
21
|
+
<tr>
|
22
|
+
<th>ISO-Code</th>
|
23
|
+
<th>Name</th>
|
24
|
+
<th>State</th>
|
25
|
+
<th>Available?</th>
|
26
|
+
<th>Triggers</th>
|
27
|
+
<th>Actions</th>
|
28
|
+
</tr>
|
29
|
+
</thead>
|
30
|
+
<tbody>
|
31
|
+
<% @locales.each do |locale| %>
|
32
|
+
<% if locale.locale_state == "live" && I18n.available_locales.include?(locale.iso_code.to_sym) %>
|
33
|
+
<% trclass = "success" %>
|
34
|
+
<% elsif locale.locale_state == "active" && I18n.available_locales.include?(locale.iso_code.to_sym) %>
|
35
|
+
<% trclass = "info" %>
|
36
|
+
<% elsif locale.locale_state == "inactive" && I18n.available_locales.include?(locale.iso_code.to_sym) %>
|
37
|
+
<% trclass = "warning" %>
|
38
|
+
<% elsif (locale.locale_state == "active" || locale.locale_state == "live") && !I18n.available_locales.include?(locale.iso_code.to_sym) %>
|
39
|
+
<% trclass = "danger" %>
|
40
|
+
<% else %>
|
41
|
+
<% trclass = "" %>
|
42
|
+
<% end %>
|
43
|
+
<tr class="<%= trclass %>">
|
44
|
+
<td>
|
45
|
+
<%= locale_flag( locale.iso_code, "small" ) %>
|
46
|
+
<%= locale.iso_code %>
|
47
|
+
<% if I18n.default_locale.to_s == locale.iso_code %>
|
48
|
+
|
49
|
+
<span class="label label-success">main</span>
|
50
|
+
<% end %>
|
51
|
+
</td>
|
52
|
+
<td><strong><%= locale.name %></strong></td>
|
53
|
+
<td><%= t("helpers.label.wizard_locale.states.#{locale.locale_state}") %></td>
|
54
|
+
<td>
|
55
|
+
<% if I18n.available_locales.include?(locale.iso_code.to_sym) %>
|
56
|
+
<span class="text-success">Yeah!</span>
|
57
|
+
<% else %>
|
58
|
+
<span class="text-danger">Not Available!</span>
|
59
|
+
<% end %>
|
60
|
+
</td>
|
61
|
+
<td>
|
62
|
+
<% %w(activate release deactivate).each do |state| %>
|
63
|
+
<% if locale.state.trigger?(state.to_sym) %>
|
64
|
+
<%= link_to state.to_s.titleize, url_for( controller: "magic_locales/locales", action: :trigger, id: locale, state: state), class: "btn btn-default btn-sm" %>
|
65
|
+
<% end %>
|
66
|
+
<% end %>
|
67
|
+
</td>
|
68
|
+
<td>
|
69
|
+
<%= link_to "edit", url_for( controller: "magic_locales/locales", action: :edit, id: locale), class: "btn btn-default btn-sm", data: { toggle: "modal", target: "#appModal" } %>
|
70
|
+
</td>
|
71
|
+
</tr>
|
72
|
+
<% end %>
|
73
|
+
</tbody>
|
74
|
+
</table>
|
75
|
+
|
76
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
##
|
2
|
+
## Need authentication for locale admin routes use this:
|
3
|
+
##
|
4
|
+
# => MagicLocales::BaseController.class_eval do
|
5
|
+
# => private
|
6
|
+
# => # overwrite authentication method
|
7
|
+
# => def authenticate_visitor
|
8
|
+
# => unless current_user && current_user.is_admin?
|
9
|
+
# => session["user_return_to"] = request.fullpath
|
10
|
+
# => redirect_to new_user_session_path, alert: "Only for admins, dude!"
|
11
|
+
# => end
|
12
|
+
# => end
|
13
|
+
# => end
|
@@ -3,6 +3,10 @@ require "action_view/helpers/asset_tag_helper"
|
|
3
3
|
# encoding: utf-8
|
4
4
|
module FlagHelper
|
5
5
|
|
6
|
+
def magic_locaoles_admin_template(options = {}, &block)
|
7
|
+
options.merge!(:body => capture(&block))
|
8
|
+
render(:partial => "magic_locaoles/admin_template", :locals => options)
|
9
|
+
end
|
6
10
|
|
7
11
|
def flag( lcl = I18n.locale.to_s )
|
8
12
|
# raw( image_tag( "flags/flags_#{lcl}.png", class: "flag" ) )
|
@@ -5865,3 +5865,85 @@ Started GET "/assets/flags/locales/small/flag-de-5f3fc0bd02b5f61f56bee27c9250c2f
|
|
5865
5865
|
|
5866
5866
|
|
5867
5867
|
Started GET "/assets/flags/locales/small/flag-sv-e180e33f1b399e3ea6a7e31e4d2beb90.png" for ::1 at 2015-03-31 15:51:16 +0200
|
5868
|
+
|
5869
|
+
|
5870
|
+
Started GET "/" for ::1 at 2015-04-04 11:38:50 +0200
|
5871
|
+
Processing by PagesController#start as HTML
|
5872
|
+
[1m[36mMagicLocales::Locale Load (1.9ms)[0m [1mSELECT "mgclang_locales".* FROM "mgclang_locales" WHERE "mgclang_locales"."locale_state" IN ('active', 'live')[0m
|
5873
|
+
[1m[35mCACHE (0.0ms)[0m SELECT "mgclang_locales".* FROM "mgclang_locales" WHERE "mgclang_locales"."locale_state" IN ('active', 'live')
|
5874
|
+
Rendered pages/start.html.erb within layouts/application (2.9ms)
|
5875
|
+
Completed 200 OK in 51ms (Views: 32.5ms | ActiveRecord: 1.9ms)
|
5876
|
+
|
5877
|
+
|
5878
|
+
Started GET "/assets/application-5266d2988799ecc8fe6e81eaab412e7d.css?body=1" for ::1 at 2015-04-04 11:38:50 +0200
|
5879
|
+
|
5880
|
+
|
5881
|
+
Started GET "/assets/application-5f1f3a0d9f2a8d9e8fcda8edadddaf68.js?body=1" for ::1 at 2015-04-04 11:38:50 +0200
|
5882
|
+
|
5883
|
+
|
5884
|
+
Started GET "/" for ::1 at 2015-04-06 01:33:21 +0200
|
5885
|
+
Processing by PagesController#start as HTML
|
5886
|
+
[1m[36mMagicLocales::Locale Load (0.4ms)[0m [1mSELECT "mgclang_locales".* FROM "mgclang_locales" WHERE "mgclang_locales"."locale_state" IN ('active', 'live')[0m
|
5887
|
+
[1m[35mCACHE (0.0ms)[0m SELECT "mgclang_locales".* FROM "mgclang_locales" WHERE "mgclang_locales"."locale_state" IN ('active', 'live')
|
5888
|
+
Rendered pages/start.html.erb within layouts/application (0.1ms)
|
5889
|
+
Completed 200 OK in 11ms (Views: 8.9ms | ActiveRecord: 0.4ms)
|
5890
|
+
|
5891
|
+
|
5892
|
+
Started GET "/assets/application-5266d2988799ecc8fe6e81eaab412e7d.css?body=1" for ::1 at 2015-04-06 01:33:21 +0200
|
5893
|
+
|
5894
|
+
|
5895
|
+
Started GET "/assets/application-5f1f3a0d9f2a8d9e8fcda8edadddaf68.js?body=1" for ::1 at 2015-04-06 01:33:21 +0200
|
5896
|
+
|
5897
|
+
|
5898
|
+
Started GET "/assets/flags/locales/small/flag-de-5f3fc0bd02b5f61f56bee27c9250c2f6.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5899
|
+
|
5900
|
+
|
5901
|
+
Started GET "/assets/flags/locales/small/flag-it-dc01b6ed369586701dd1d0174dbddd19.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5902
|
+
|
5903
|
+
|
5904
|
+
Started GET "/assets/flags/locales/small/flag-en-8f2b5a753addd004e03415acaa183c5c.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5905
|
+
|
5906
|
+
|
5907
|
+
Started GET "/assets/flags/locales/small/flag-es-2979d52156ba9f6a4994e5e3a1e76944.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5908
|
+
|
5909
|
+
|
5910
|
+
Started GET "/assets/flags/locales/small/flag-fr-1bea0274582b3fc4271136e8da5be5d1.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5911
|
+
|
5912
|
+
|
5913
|
+
Started GET "/assets/flags/locales/small/flag-sv-e180e33f1b399e3ea6a7e31e4d2beb90.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5914
|
+
|
5915
|
+
|
5916
|
+
Started GET "/assets/flags/locales/small/flag-bg-1efc22542d2849639122ff49ea33ac3d.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5917
|
+
|
5918
|
+
|
5919
|
+
Started GET "/assets/flags/locales/small/flag-da-2ac9e0a37c1b9ab366c99c7fdc00a493.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5920
|
+
|
5921
|
+
|
5922
|
+
Started GET "/assets/flags/locales/small/flag-cs-cb81ae0381c0d2b10bfe14059f2266e8.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5923
|
+
|
5924
|
+
|
5925
|
+
Started GET "/assets/flags/locales/small/flag-fi-c8b23347780a62efa0d64af9849cc115.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5926
|
+
|
5927
|
+
|
5928
|
+
Started GET "/assets/flags/locales/small/flag-hr-8aa0e1496810a9e0b162ed5a3f5fe380.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5929
|
+
|
5930
|
+
|
5931
|
+
Started GET "/assets/flags/locales/small/flag-el-d42b887c3b638601c01d4bc70ec181f8.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5932
|
+
|
5933
|
+
|
5934
|
+
Started GET "/assets/flags/locales/small/flag-pl-5abcbc087311dd7839b4010b988e4aeb.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5935
|
+
|
5936
|
+
|
5937
|
+
Started GET "/assets/flags/locales/small/flag-uk-78755f6d556ff84d4d099fe839b43944.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5938
|
+
|
5939
|
+
|
5940
|
+
Started GET "/assets/flags/locales/small/flag-ru-ca54826af3df2831f5b67b73b1611e79.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5941
|
+
|
5942
|
+
|
5943
|
+
Started GET "/assets/flags/locales/small/flag-hu-3625c00843f151a74e3f12ef0b250877.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5944
|
+
|
5945
|
+
|
5946
|
+
Started GET "/assets/flags/locales/small/flag-pt-3c8e356891aef440e538135545182bee.png" for ::1 at 2015-04-07 09:31:46 +0200
|
5947
|
+
|
5948
|
+
|
5949
|
+
Started GET "/assets/flags/locales/small/flag-nl-2e26e18ecca4b90bf4bd29712edf57ad.png" for ::1 at 2015-04-07 09:31:46 +0200
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magic_locales
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Torsten Wetzel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/app/models/magic_locales/association.rb
|
112
112
|
- lib/app/models/magic_locales/language.rb
|
113
113
|
- lib/app/models/magic_locales/locale.rb
|
114
|
+
- lib/app/views/magic_locales/_admin_template.html.erb
|
114
115
|
- lib/app/views/magic_locales/_locale_switch.html.erb
|
115
116
|
- lib/app/views/magic_locales/locales/_globalized_name_fields.html.erb
|
116
117
|
- lib/app/views/magic_locales/locales/form.html.erb
|
@@ -462,6 +463,7 @@ files:
|
|
462
463
|
- lib/assets/images/flags/locales/small/square-xx.png
|
463
464
|
- lib/generators/magic_locales/install_generator.rb
|
464
465
|
- lib/generators/magic_locales/templates/locale_seeds.rb
|
466
|
+
- lib/generators/magic_locales/templates/magic_initializer.rb
|
465
467
|
- lib/generators/magic_locales/templates/magic_logales_migration.rb
|
466
468
|
- lib/magic_locales.rb
|
467
469
|
- lib/magic_locales/flag_helper.rb
|
@@ -559,7 +561,6 @@ files:
|
|
559
561
|
- spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
560
562
|
- spec/dummy/tmp/cache/assets/development/sprockets/fb084b448735966191ed041270ff5212
|
561
563
|
- spec/dummy/tmp/cache/assets/development/sprockets/ffe3973c98878fae13cf4974dee3ae68
|
562
|
-
- spec/dummy/tmp/pids/server.pid
|
563
564
|
- spec/models/magic_locales/association_spec.rb
|
564
565
|
- spec/models/magic_locales/language_spec.rb
|
565
566
|
- spec/models/magic_locales/locale_spec.rb
|
@@ -586,7 +587,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
586
587
|
version: '0'
|
587
588
|
requirements: []
|
588
589
|
rubyforge_project:
|
589
|
-
rubygems_version: 2.
|
590
|
+
rubygems_version: 2.5.0
|
590
591
|
signing_key:
|
591
592
|
specification_version: 4
|
592
593
|
summary: Rails gem to help with common european locales.
|
@@ -679,7 +680,6 @@ test_files:
|
|
679
680
|
- spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
680
681
|
- spec/dummy/tmp/cache/assets/development/sprockets/fb084b448735966191ed041270ff5212
|
681
682
|
- spec/dummy/tmp/cache/assets/development/sprockets/ffe3973c98878fae13cf4974dee3ae68
|
682
|
-
- spec/dummy/tmp/pids/server.pid
|
683
683
|
- spec/models/magic_locales/association_spec.rb
|
684
684
|
- spec/models/magic_locales/language_spec.rb
|
685
685
|
- spec/models/magic_locales/locale_spec.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
27954
|