adminpanel 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/adminpanel.gemspec +20 -18
- data/app/assets/javascripts/adminpanel/jquery.knob.js +652 -0
- data/app/assets/javascripts/adminpanel/realm.js +20 -18
- data/app/assets/javascripts/adminpanel/spinner.js.coffee +3 -3
- data/app/controllers/adminpanel/analytics_controller.rb +99 -53
- data/app/controllers/adminpanel/auths_controller.rb +1 -1
- data/app/controllers/adminpanel/sessions_controller.rb +26 -26
- data/app/controllers/concerns/adminpanel/facebook_actions.rb +2 -2
- data/app/helpers/adminpanel/adminpanel_form_builder.rb +257 -298
- data/app/helpers/adminpanel/analytics_helper.rb +46 -0
- data/app/helpers/adminpanel/application_helper.rb +57 -57
- data/app/helpers/adminpanel/breadcrumbs_helper.rb +13 -13
- data/app/helpers/adminpanel/sessions_helper.rb +20 -20
- data/app/helpers/adminpanel/shared_pages_helper.rb +41 -41
- data/app/models/adminpanel/gallery.rb +65 -63
- data/app/models/adminpanel/image.rb +5 -5
- data/app/models/adminpanel/section.rb +61 -53
- data/app/models/adminpanel/user.rb +1 -6
- data/app/models/concerns/adminpanel/facebook.rb +1 -1
- data/app/uploaders/adminpanel/gallery_uploader.rb +1 -1
- data/app/views/adminpanel/analytics/_widget_task_statistics.html.erb +63 -0
- data/app/views/adminpanel/analytics/fb.html.erb +98 -0
- data/app/views/adminpanel/analytics/index.html.erb +8 -8
- data/app/views/adminpanel/galleries/_galleries_table.html.erb +12 -12
- data/app/views/adminpanel/galleries/move_better.js.erb +1 -1
- data/app/views/adminpanel/galleries/move_worst.js.erb +1 -1
- data/app/views/adminpanel/sections/_sections_table.html.erb +7 -7
- data/app/views/adminpanel/sections/show.html.erb +25 -25
- data/app/views/adminpanel/sessions/new.html.erb +22 -22
- data/app/views/layouts/_shim.html.erb +1 -1
- data/app/views/layouts/_side_menu.html.erb +35 -35
- data/app/views/layouts/admin-login.html.erb +22 -22
- data/app/views/layouts/admin.html.erb +35 -35
- data/app/views/shared/_breadcrumb.html.erb +4 -4
- data/app/views/shared/_error_messages.html.erb +15 -15
- data/app/views/shared/_form_fields.html.erb +48 -47
- data/app/views/shared/_image_fields.html.erb +1 -1
- data/config/initializers/pluralization_es.rb +1 -1
- data/config/locales/es.yml +38 -2
- data/config/routes.rb +5 -4
- data/lib/adminpanel/version.rb +1 -1
- data/lib/generators/adminpanel/gallery/templates/gallery_migration.rb +5 -5
- data/lib/generators/adminpanel/gallery/templates/uploader.rb +1 -1
- data/lib/generators/adminpanel/initialize/initialize_generator.rb +54 -54
- data/lib/generators/adminpanel/initialize/templates/category_template.rb +1 -1
- data/lib/generators/adminpanel/initialize/templates/create_adminpanel_categories_table.rb +5 -5
- data/lib/generators/adminpanel/initialize/templates/create_adminpanel_tables.rb +57 -57
- data/lib/generators/adminpanel/initialize/templates/section_uploader.rb +1 -1
- data/lib/generators/adminpanel/migration/migration_generator.rb +44 -0
- data/lib/generators/adminpanel/migration/migration_generator_helper.rb +19 -0
- data/lib/generators/adminpanel/resource/resource_generator.rb +60 -245
- data/lib/generators/adminpanel/resource/resource_generator_helper.rb +189 -0
- data/lib/generators/adminpanel/resource/templates/{controller.rb → adminpanel_controller_template.rb} +2 -2
- data/lib/generators/adminpanel/resource/templates/{resource.rb → adminpanel_resource_template.rb} +0 -0
- data/test/dummy/app/models/adminpanel/categorization.rb +2 -2
- data/test/dummy/app/models/adminpanel/category.rb +3 -3
- data/test/dummy/app/models/adminpanel/department.rb +2 -2
- data/test/dummy/app/models/adminpanel/item.rb +3 -3
- data/test/dummy/app/models/adminpanel/mug.rb +14 -14
- data/test/dummy/app/models/adminpanel/product.rb +19 -19
- data/test/dummy/app/models/adminpanel/salesman.rb +15 -15
- data/test/dummy/app/uploader/adminpanel/photo_uploader.rb +1 -1
- data/test/dummy/app/views/layouts/application.html.erb +9 -9
- data/test/dummy/config/boot.rb +1 -1
- data/test/features/shared/{belongs_to_category_modal_test.rb → form/belongs_to_category_modal_test.rb} +0 -0
- data/test/features/shared/{belongs_to_non_category_modal_test.rb → form/belongs_to_non_category_modal_test.rb} +0 -0
- data/test/features/shared/{has_many_through_category_modal_test.rb → form/has_many_through_category_modal_test.rb} +0 -0
- data/test/features/shared/{has_many_through_non_category_modal_test.rb → form/has_many_through_non_category_modal_test.rb} +0 -0
- data/test/features/shared/{edit_test.rb → resource/edit_test.rb} +0 -0
- data/test/features/shared/{index_test.rb → resource/index_test.rb} +0 -0
- data/test/features/shared/{new_test.rb → resource/new_test.rb} +0 -0
- data/test/features/shared/{show_test.rb → resource/show_test.rb} +0 -0
- data/test/features/shared/{action_exclution_test.rb → ui/action_exclution_test.rb} +0 -0
- data/test/test_helper.rb +1 -1
- metadata +44 -32
- data/test/dummy/app/controllers/adminpanel/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
@@ -15,5 +15,5 @@ ActiveSupport::Inflector.inflections(:es) do |inflect|
|
|
15
15
|
inflect.irregular('el', 'los')
|
16
16
|
|
17
17
|
inflect.irregular('Galería de Inicio', 'Galería de Inicio')
|
18
|
-
inflect.irregular('
|
18
|
+
inflect.irregular('Analytics', 'Analytics')
|
19
19
|
end
|
data/config/locales/es.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
es:
|
2
2
|
model:
|
3
|
-
Analytic: '
|
3
|
+
Analytic: 'Analytics'
|
4
4
|
Gallery: 'Galería de Inicio'
|
5
5
|
Categories: 'Categorías'
|
6
6
|
attributes:
|
@@ -34,7 +34,7 @@ es:
|
|
34
34
|
too_short: 'es muy corta, mínimo 6 caracteres'
|
35
35
|
time:
|
36
36
|
formats:
|
37
|
-
|
37
|
+
default: '%d/%m/%Y'
|
38
38
|
estimate: '%Y-%m-%d'
|
39
39
|
Add Image: 'Agregar Imagen'
|
40
40
|
wysiwyg:
|
@@ -97,6 +97,42 @@ es:
|
|
97
97
|
show: 'ver'
|
98
98
|
signout: 'cerrar-sesion'
|
99
99
|
signin: 'iniciar-sesion'
|
100
|
+
analytics:
|
101
|
+
day: 'Hoy'
|
102
|
+
days_28: 'el mes'
|
103
|
+
now: 'Ahora'
|
104
|
+
week: 'Semana'
|
105
|
+
month: 'Mes'
|
106
|
+
search: 'Buscar'
|
107
|
+
impressions: 'Impresiones'
|
108
|
+
unique: 'Únicas'
|
109
|
+
for: 'Estadísticas para '
|
110
|
+
facebook: 'Estadísticas de Facebook'
|
111
|
+
explanation: 'Explicación de las métricas'
|
112
|
+
description:
|
113
|
+
page_stories: '(Periodo) El número de historias creadas acerca de tu página (Cuenta total)'
|
114
|
+
page_consumptions: '(Periodo) El número de clicks en cualquiera de tus contenidos. Clicks generando historias están incluidos en otros clicks. Historias generadas sin clicks en la página (e.g., Darle like a la página en el `Timeline`) no son incluidos. (Cuenta total)'
|
115
|
+
page_consumptions_unique: '(Periodo) El número de clicks de usuarios diferentes en cualquiera de tus contenidos. Clicks generando historias están incluidos en otros clicks. Historias generadas sin clicks en la página (e.g., Darle like a la página en el `Timeline`) no son incluidos. (Usuarios únicos)'
|
116
|
+
page_views: '(Hoy) El total de vistas a la página (Cuenta total)'
|
117
|
+
page_views_unique: '(Hoy) El total de vistas a la página de usuarios loggeados en Facebook (Usuarios únicos)'
|
118
|
+
page_negative_feedback: '(Periodo) El número de veces que la gente te ha dado retroalimentación negativa (Unlike o Escoder página o post)(Cuenta total)'
|
119
|
+
page_negative_feedback_unique: '(Periodo) El número de personas que te ha dado retroalimentación negativa (Unlike o Escoder página o post)(Usuarios únicos)'
|
120
|
+
page_fans: '(Total) El número total de personas que ha dado like(me gusta) a la página (Usuarios únicos)'
|
121
|
+
page_fan_adds: '(Hoy) El número total de personas nuevas que le ha gustado tu página (Cuenta total)'
|
122
|
+
page_impressions_unique: '(Periodo) El número de personas que han visto cualquier contenido asociado con tu página (Usuarios únicos)'
|
123
|
+
page_impressions: '(Período) El número de impresiones vistas de cualquier contenido asociado con la página. (Cuenta Total)'
|
124
|
+
metrics:
|
125
|
+
page_stories: 'Hablando de esto'
|
126
|
+
page_consumptions: 'Clicks Totales'
|
127
|
+
page_consumptions_unique: 'Clicks de usuarios únicos'
|
128
|
+
page_views: 'Vistas a la página'
|
129
|
+
page_views_unique: 'Vistas de usuarios únicos a la página'
|
130
|
+
page_negative_feedback: 'Acciones negativas'
|
131
|
+
page_negative_feedback_unique: 'Acciones negativas de personas diferentes'
|
132
|
+
page_fans: 'Likes Totales'
|
133
|
+
page_fan_adds: 'Likes Nuevos'
|
134
|
+
page_impressions_unique: 'Impresiones de página de personas diferentes'
|
135
|
+
page_impressions: 'Impresiones de página'
|
100
136
|
fb:
|
101
137
|
posted: 'Publicado en el muro de %{user}'
|
102
138
|
confirm_page: 'Seleccionar Cuenta'
|
data/config/routes.rb
CHANGED
@@ -18,10 +18,11 @@ Adminpanel::Engine.routes.draw do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
when :analytics
|
21
|
-
resources :analytics, resources_parameters(resource).merge(
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
resources :analytics, resources_parameters(resource).merge({ only: [:index] }) do
|
22
|
+
collection do
|
23
|
+
get :fb, to:'analytics#fb', as: 'fb', path:'facebook'
|
24
|
+
end
|
25
|
+
end
|
25
26
|
else
|
26
27
|
if !get_gallery_children(resource).nil?
|
27
28
|
# make the resources gallery routes
|
data/lib/adminpanel/version.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
class CreateAdminpanel<%= class_name.pluralize %> < ActiveRecord::Migration
|
2
|
-
|
3
|
-
|
2
|
+
def change
|
3
|
+
create_table :adminpanel_<%= lower_name.pluralize %> do |t|
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
t.integer :<%= reference_name %>_id
|
6
|
+
t.string :file
|
7
7
|
|
8
|
-
|
8
|
+
t.timestamps
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -1,65 +1,65 @@
|
|
1
1
|
require 'rails/generators/active_record'
|
2
2
|
module Adminpanel
|
3
|
-
|
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
|
-
|
3
|
+
class InitializeGenerator < ActiveRecord::Generators::Base
|
4
|
+
desc "Generate the migrations necessary to start the gem"
|
5
|
+
source_root File.expand_path("../templates", __FILE__)
|
6
|
+
argument :name, :type => :string, :default => "default", :require => false
|
7
|
+
class_option :'skip-category',
|
8
|
+
:type => :boolean,
|
9
|
+
:aliases => '-c',
|
10
|
+
:default => false,
|
11
|
+
:desc => "Skip category skeleton and migration for it if true"
|
12
|
+
class_option :'skip-section-uploader',
|
13
|
+
:type => :boolean,
|
14
|
+
:aliases => '-u',
|
15
|
+
:default => false,
|
16
|
+
:desc => 'Skip section uploader if true'
|
17
|
+
class_option :'skip-migration',
|
18
|
+
:type => :boolean,
|
19
|
+
:aliases => '-m',
|
20
|
+
:default => false,
|
21
|
+
:desc => 'Skip initial migrations if true'
|
22
|
+
class_option :'skip-setup',
|
23
|
+
:type => :boolean,
|
24
|
+
:aliases => '-p',
|
25
|
+
:default => false,
|
26
|
+
:desc => 'Skip setup if true'
|
27
|
+
class_option :'skip-setup',
|
28
|
+
:type => :boolean,
|
29
|
+
:aliases => '-y',
|
30
|
+
:default => false,
|
31
|
+
:desc => 'Skip cancan\'s ability.rb'
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
def create_initializer
|
34
|
+
if !options[:'skip-setup']
|
35
|
+
copy_file 'adminpanel_setup.rb', 'config/initializers/adminpanel_setup.rb'
|
36
|
+
end
|
37
|
+
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
def create_ability
|
40
|
+
if !options[:'skip-ability']
|
41
|
+
copy_file 'ability.rb', 'app/models/ability.rb'
|
42
|
+
end
|
43
|
+
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
def create_category
|
46
|
+
if !options[:'skip-category']
|
47
|
+
copy_file "category_template.rb", 'app/models/adminpanel/category.rb'
|
48
48
|
migration_template 'create_adminpanel_categories_table.rb', 'db/migrate/create_adminpanel_categories_table.rb'
|
49
|
-
|
50
|
-
|
49
|
+
end
|
50
|
+
end
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
def create_section_uploader
|
53
|
+
if !options[:'skip-section-uploader']
|
54
|
+
copy_file "section_uploader.rb", 'app/uploaders/adminpanel/section_uploader.rb'
|
55
|
+
end
|
56
|
+
end
|
57
57
|
|
58
|
-
|
59
|
-
|
58
|
+
def create_adminpanel_migration
|
59
|
+
if !options[:'skip-migration']
|
60
60
|
migration_template 'create_adminpanel_tables.rb', 'db/migrate/create_adminpanel_tables.rb'
|
61
|
-
|
62
|
-
|
61
|
+
end
|
62
|
+
end
|
63
63
|
|
64
|
-
|
64
|
+
end
|
65
65
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class CreateAdminpanelCategoriesTable < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
|
3
|
+
create_table :adminpanel_categories do |t|
|
4
4
|
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
t.string :name
|
7
|
+
t.string :model
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
10
|
end
|
11
11
|
end
|
@@ -1,68 +1,68 @@
|
|
1
1
|
class CreateAdminpanelTables < ActiveRecord::Migration
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
def migrate(direction)
|
3
|
+
super
|
4
|
+
# Create a default user
|
5
|
+
if direction == :up
|
6
|
+
if Rails.env.development?
|
7
|
+
group = Adminpanel::Group.new(:name => "Admin")
|
8
|
+
group.save
|
9
|
+
Adminpanel::User.new(:email => 'admin@admin.com', :name => "Admin", :password => 'password', :password_confirmation => 'password', :group_id => group.id).save
|
10
|
+
puts "The password for admin@admin.com is: password"
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
def change
|
17
|
+
create_table :adminpanel_users do |t|
|
18
|
+
t.string :name
|
19
|
+
t.string :email
|
20
|
+
t.string :group_id
|
21
|
+
t.string :password_digest
|
22
|
+
t.string :remember_token
|
23
|
+
t.timestamps
|
24
|
+
end
|
25
|
+
add_index :adminpanel_users, [:email]
|
26
|
+
add_index :adminpanel_users, [:remember_token]
|
27
27
|
|
28
28
|
create_table :adminpanel_galleries do |t|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
t.string :file
|
30
|
+
t.integer :position
|
31
|
+
t.timestamps
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
create_table :adminpanel_images do |t|
|
35
|
+
t.string :file
|
36
|
+
t.integer :section_id
|
37
|
+
t.timestamps
|
38
|
+
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
create_table :adminpanel_groups do |t|
|
41
|
+
t.string :name
|
42
|
+
t.timestamps
|
43
|
+
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
45
|
+
create_table :adminpanel_auths do |t|
|
46
|
+
t.string :name
|
47
|
+
t.string :key
|
48
|
+
t.string :value
|
49
|
+
t.datetime :created_at, :null => false
|
50
|
+
t.datetime :updated_at, :null => false
|
51
|
+
end
|
52
|
+
add_index :adminpanel_auths, [:name]
|
53
|
+
add_index :adminpanel_auths, [:key]
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
55
|
+
create_table :adminpanel_sections do |t|
|
56
|
+
t.string :name
|
57
|
+
t.boolean :has_description
|
58
|
+
t.text :description
|
59
|
+
t.string :key
|
60
|
+
t.string :page
|
61
|
+
t.boolean :has_image
|
62
|
+
t.timestamps
|
63
|
+
end
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
add_index :adminpanel_sections, [:key]
|
66
|
+
add_index :adminpanel_sections, [:page]
|
67
|
+
end
|
68
68
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
require 'generators/adminpanel/resource/resource_generator_helper'
|
3
|
+
require 'generators/adminpanel/migration/migration_generator_helper'
|
4
|
+
|
5
|
+
module Adminpanel
|
6
|
+
class MigrationGenerator < ActiveRecord::Generators::Base
|
7
|
+
include ResourceGeneratorHelper
|
8
|
+
include MigrationGeneratorHelper
|
9
|
+
|
10
|
+
source_root File.expand_path("../templates", __FILE__)
|
11
|
+
desc "Generate a migration files and updates the model and controller"
|
12
|
+
argument :fields, :type => :array, :default => [], :banner => "field[:type][:index] field[:type][:index]"
|
13
|
+
|
14
|
+
def change_field_aliases
|
15
|
+
fields.each do |attribute|
|
16
|
+
type = attribute.split(':').second
|
17
|
+
case type
|
18
|
+
when 'wysiwyg'
|
19
|
+
fields.delete(attribute)
|
20
|
+
fields << attribute.split(':').first + ':' + 'text'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def generate_migration
|
26
|
+
parameters = fields
|
27
|
+
parameters.delete_if{ |pair| pair.split(':').second == 'has_many' }
|
28
|
+
invoke :migration, [migration_name, parameters]
|
29
|
+
end
|
30
|
+
|
31
|
+
def inject_attributes_into_file
|
32
|
+
inject_into_file(
|
33
|
+
"app/models/adminpanel/#{resource_migrating}.rb",
|
34
|
+
after: ' ['
|
35
|
+
) do
|
36
|
+
indent ("\n" + get_attribute_hash + ','), 8
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def puts_messages
|
41
|
+
puts "don't forget to migrate your database"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|