ideyabox 0.1.9 → 0.1.10

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.
data/.DS_Store ADDED
Binary file
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Max Rydkin
1
+ Copyright (c) 2012-2013 Max Rydkin, Slava Kovalev
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -38,13 +38,13 @@ Generate some model or scaffold for your project
38
38
  Add */admin* route in your *config/routes.rb* in :admin namespace
39
39
 
40
40
  namespace :admin do
41
- root :to => "your_controller#your_action"
41
+ root to: "your_controller#your_action"
42
42
  end
43
43
 
44
44
  like this
45
45
 
46
46
  namespace :admin do
47
- root :to => "guests#index"
47
+ root to: "guests#index"
48
48
  end
49
49
 
50
50
  ### Generating admin assets
data/app/.DS_Store ADDED
Binary file
Binary file
data/ideyabox.gemspec CHANGED
@@ -4,7 +4,7 @@ require File.expand_path('../lib/ideyabox/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Max Rydkin", "veskakoff"]
6
6
  gem.email = ["maks.rydkin@gmail.com", "veskakov@gmail.com"]
7
- gem.description = %q{Write a gem description}
7
+ gem.description = %q{Gem for constructing admin panel}
8
8
  gem.summary = %q{Write a gem summary}
9
9
  gem.homepage = ""
10
10
 
data/lib/.DS_Store ADDED
Binary file
Binary file
Binary file
@@ -9,6 +9,7 @@ module Ideyabox
9
9
  directory "views/admin", "app/views/admin"
10
10
  directory "views/layouts", "app/views/layouts"
11
11
  directory "locales", "config/locales"
12
+ copy_file "helpers/translations_helper.rb", "app/helpers/translations_helper.rb"
12
13
  copy_file "assets/admin.scss.erb", "app/assets/stylesheets/admin.scss.erb"
13
14
  copy_file "assets/admin.js", "app/assets/javascripts/admin.js"
14
15
  copy_file "tasks/seeds.rb", "db/seeds.rb"
@@ -0,0 +1,14 @@
1
+ # encoding:utf-8
2
+ module TranslationsHelper
3
+ def plural_name(resource)
4
+ t "#{resource}.plural", default: resource.singularize.camelize.constantize.model_name.human
5
+ end
6
+
7
+ def accusative_case(resource)
8
+ t "#{resource}.accusative", default: resource.singularize.camelize.constantize.model_name.human
9
+ end
10
+
11
+ def action_accusative(resource, action)
12
+ t(action) + " " + accusative_case(resource)
13
+ end
14
+ end
@@ -1,2 +1,2 @@
1
1
  User.delete_all
2
- User.create(email: "admin@rdws.ru", password: "123123", password_confirmation:"123123")
2
+ User.create(email: "admin@rdws.ru", password: "12341234", password_confirmation:"12341234")
@@ -150,7 +150,7 @@ module Ideyabox
150
150
  end
151
151
 
152
152
  def add_to_topbar_items
153
- final_string = "\n %li{:class => \"\#\{\'active\' if c == \'#{plural_resource_name}\'}\"\}= link_to \'#{plural_resource_name}\', admin_#{plural_resource_name}_path"
153
+ final_string = "\n %li{:class => \"\#\{\'active\' if c == \'#{plural_resource_name}\'}\"\}= link_to plural_name(\'#{plural_resource_name}\'), admin_#{plural_resource_name}_path"
154
154
 
155
155
  inject_into_file "app/views/admin/shared/_topbar.html.haml", final_string, :after => "-when :section"
156
156
  end
@@ -165,6 +165,7 @@ module Ideyabox
165
165
  locales.each do |locale|
166
166
  inject_into_file "config/locales/#{locale}.yml", " #{resource_name}: \"#{resource_name}\"\n", :after => "models:\n"
167
167
  inject_into_file "config/locales/#{locale}.yml", attributes_string, :after => "attributes:\n"
168
+ inject_into_file "config/locales/#{locale}.yml", " #{plural_resource_name}:\n accusative:\n plural:\n", :after => "ru:\n"
168
169
  end
169
170
  end
170
171
 
@@ -2,9 +2,9 @@
2
2
  %p= link_to t('back'), admin_<%= controller_routing_path %>_path, :class => "bright_link"
3
3
  %h1
4
4
  - if @<%= resource_name %>.new_record?
5
- = "#{t 'add'} #{<%= @model_name.demodulize %>.model_name.human}"
5
+ = action_accusative("<%= plural_resource_name %>", "add")
6
6
  - else
7
- = "#{t 'edit'} #{<%= @model_name.demodulize %>.model_name.human}"
7
+ = action_accusative("<%= plural_resource_name %>", "edit")
8
8
 
9
9
  = form_for [:admin, @<%= resource_name %>] do |f|
10
10
  - if @<%= resource_name %>.errors.any?
@@ -1,8 +1,8 @@
1
1
  - content_for(:page_header) do
2
- %p= link_to "#{t 'add'} #{<%= @model_name.demodulize %>.model_name.human}", new_admin_<%= singular_controller_routing_path %>_path, :class => "bright_link"
3
- %h1= link_to '<%= plural_resource_name %>', admin_<%= plural_resource_name %>_path
2
+ %p= link_to action_accusative("<%= plural_resource_name %>", "add"), new_admin_<%= singular_controller_routing_path %>_path, :class => 'bright_link'
3
+ %h1= link_to plural_name("<%= plural_resource_name %>"), admin_<%= plural_resource_name %>_path
4
4
  -#= paginate @<%= plural_resource_name %>
5
- <%= if column_names.include?("position")
5
+ <%= if column_names.include?('position')
6
6
  "= render 'sort_buttons' "
7
7
  end %>
8
8
  #index_wr
@@ -1,3 +1,3 @@
1
1
  module Ideyabox
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ideyabox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,9 +10,9 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-04-09 00:00:00.000000000 Z
13
+ date: 2013-08-09 00:00:00.000000000 Z
14
14
  dependencies: []
15
- description: Write a gem description
15
+ description: Gem for constructing admin panel
16
16
  email:
17
17
  - maks.rydkin@gmail.com
18
18
  - veskakov@gmail.com
@@ -20,11 +20,13 @@ executables: []
20
20
  extensions: []
21
21
  extra_rdoc_files: []
22
22
  files:
23
+ - .DS_Store
23
24
  - .gitignore
24
25
  - Gemfile
25
26
  - LICENSE
26
27
  - README.md
27
28
  - Rakefile
29
+ - app/.DS_Store
28
30
  - app/assets/images/admin/addphoto.png
29
31
  - app/assets/images/admin/background-image.png
30
32
  - app/assets/images/admin/rdws_cat.png
@@ -56,15 +58,22 @@ files:
56
58
  - app/assets/stylesheets/font_awesome/font/fontawesome-webfont.woff
57
59
  - app/assets/stylesheets/jquery.Jcrop.css
58
60
  - app/assets/stylesheets/normalize.css
61
+ - app/helpers/.DS_Store
59
62
  - app/helpers/admin_helper.rb
60
63
  - app/tasks/reset_db.rake
61
64
  - ideyabox.gemspec
65
+ - lib/.DS_Store
62
66
  - lib/ar_ideyabox.rb
67
+ - lib/generators/.DS_Store
68
+ - lib/generators/ideyabox/.DS_Store
69
+ - lib/generators/ideyabox/admin/.DS_Store
63
70
  - lib/generators/ideyabox/admin/admin_generator.rb
71
+ - lib/generators/ideyabox/admin/templates/.DS_Store
64
72
  - lib/generators/ideyabox/admin/templates/assets/admin.js
65
73
  - lib/generators/ideyabox/admin/templates/assets/admin.scss.erb
66
74
  - lib/generators/ideyabox/admin/templates/controllers/admin/application_controller.rb
67
75
  - lib/generators/ideyabox/admin/templates/controllers/application_controller.rb
76
+ - lib/generators/ideyabox/admin/templates/helpers/translations_helper.rb
68
77
  - lib/generators/ideyabox/admin/templates/locales/devise.ru.yml
69
78
  - lib/generators/ideyabox/admin/templates/locales/en.yml
70
79
  - lib/generators/ideyabox/admin/templates/locales/ru.yml
@@ -127,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
136
  version: '0'
128
137
  requirements: []
129
138
  rubyforge_project:
130
- rubygems_version: 1.8.24
139
+ rubygems_version: 1.8.25
131
140
  signing_key:
132
141
  specification_version: 3
133
142
  summary: Write a gem summary