adminpanel 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/app/assets/stylesheets/adminpanel/theme.css +46 -41
  2. data/app/controllers/adminpanel/categories_controller.rb +71 -0
  3. data/app/controllers/adminpanel/users_controller.rb +69 -69
  4. data/app/helpers/adminpanel/application_helper.rb +2 -1
  5. data/app/helpers/adminpanel/class_definitions_helper.rb +10 -0
  6. data/app/helpers/adminpanel/custom_form_builder.rb +23 -24
  7. data/app/helpers/adminpanel/pluralizations_helper.rb +21 -0
  8. data/app/helpers/adminpanel/rest_actions_helper.rb +42 -34
  9. data/app/helpers/adminpanel/router_helper.rb +30 -26
  10. data/app/models/adminpanel/gallery.rb +6 -2
  11. data/app/models/adminpanel/image.rb +1 -1
  12. data/app/models/adminpanel/user.rb +15 -1
  13. data/app/views/adminpanel/categories/_categories_table.html.erb +48 -0
  14. data/app/views/adminpanel/categories/_category_form.html.erb +14 -0
  15. data/app/views/adminpanel/categories/index.html.erb +55 -0
  16. data/app/views/adminpanel/categories/new.js.erb +1 -0
  17. data/app/views/layouts/_side_menu.html.erb +91 -22
  18. data/app/views/shared/_error_messages.html.erb +3 -3
  19. data/app/views/shared/_form_fields.html.erb +14 -13
  20. data/app/views/shared/index.html.erb +1 -1
  21. data/config/locales/es.yml +5 -10
  22. data/config/routes.rb +20 -9
  23. data/lib/adminpanel/active_record_extension.rb +52 -8
  24. data/lib/adminpanel/engine.rb +4 -2
  25. data/lib/adminpanel/version.rb +1 -1
  26. data/lib/generators/adminpanel/initialize/initialize_generator.rb +20 -6
  27. data/lib/generators/adminpanel/initialize/templates/adminpanel_setup.rb +16 -0
  28. data/lib/generators/adminpanel/initialize/templates/category_template.rb +32 -0
  29. data/lib/generators/adminpanel/initialize/templates/create_adminpanel_categories_table.rb +11 -0
  30. data/lib/generators/adminpanel/resource/resource_generator.rb +1 -1
  31. data/lib/tasks/adminpanel/adminpanel.rake +4 -4
  32. data/spec/dummy/app/controllers/adminpanel/categories_controller.rb +1 -1
  33. data/spec/dummy/app/models/adminpanel/categorization.rb +5 -5
  34. data/spec/dummy/app/models/adminpanel/category.rb +9 -9
  35. data/spec/generators/initialize_generator_spec.rb +34 -0
  36. data/spec/generators/{resource_spec.rb → resource_generator_spec.rb} +0 -0
  37. data/spec/models/user_spec.rb +3 -3
  38. metadata +18 -19
  39. data/app/helpers/adminpanel/images_helper.rb +0 -10
  40. data/app/views/adminpanel/users/_user_form.html.erb +0 -21
  41. data/app/views/adminpanel/users/edit.html.erb +0 -6
  42. data/app/views/adminpanel/users/index.html.erb +0 -49
  43. data/app/views/adminpanel/users/new.html.erb +0 -6
  44. data/app/views/adminpanel/users/show.html.erb +0 -21
  45. data/config/locales/en.yml +0 -5
  46. data/spec/dummy/config/initializers/inflections.rb +0 -15
  47. data/spec/features/user_pages_spec.rb +0 -48
  48. data/spec/generators/initialize_spec.rb +0 -9
@@ -74,9 +74,9 @@ input.knob{
74
74
  display: none;
75
75
  }
76
76
  .pad15{
77
- padding: 15px;
77
+ padding: 15px;
78
78
  }
79
- .form-actions{
79
+ .form-actions{
80
80
  margin-bottom: 0;
81
81
  }
82
82
  .breadcrumb {
@@ -85,7 +85,7 @@ input.knob{
85
85
  padding: 8px 0;
86
86
  }
87
87
  .breadcrumb > li{
88
- text-shadow: none;
88
+ text-shadow: none;
89
89
  }
90
90
  .heading{
91
91
  border-bottom: 1px solid #EBEBEB;
@@ -102,7 +102,7 @@ input.knob{
102
102
  border: 1px solid #DDDDDD;
103
103
  -moz-border-radius: 3px 3px 3px 3px;
104
104
  -webkit-border-radius: 3px 3px 3px 3px;
105
- border-radius: 3px 3px 3px 3px;
105
+ border-radius: 3px 3px 3px 3px;
106
106
  }
107
107
  .container-narrow{
108
108
  width: 95%;
@@ -210,7 +210,7 @@ select, textarea, input[type="text"], input[type="password"], input[type="dateti
210
210
  /* top menu notifications/messages */
211
211
  .top-menu .popover.bottom .arrow:after {
212
212
  border-bottom-color: #F7F7F7;
213
- }
213
+ }
214
214
  .top-menu .popover{
215
215
  width:300px;
216
216
  }
@@ -239,25 +239,25 @@ select, textarea, input[type="text"], input[type="password"], input[type="dateti
239
239
  color: #333;
240
240
  line-height: 15px;
241
241
  text-decoration: none;
242
- }
242
+ }
243
243
  .top-menu .popover-content li a h4{
244
244
  display: block;
245
245
  font-size:12px;
246
246
  font-weight:bold;
247
247
  margin:0;
248
- }
248
+ }
249
249
  .top-menu .popover-content li a span{
250
250
  display: block;
251
251
  font-size:10px;
252
252
  color: #A8A8A8;
253
253
  float:right;
254
- }
254
+ }
255
255
  .top-menu .popover-content li a img{
256
256
  height: 35px;
257
257
  left: 5px;
258
258
  position: absolute;
259
259
  width: 35px;
260
- }
260
+ }
261
261
  .top-menu .popover-content .popover_footer a{
262
262
  background: none repeat scroll 0 0 #F7F7F7;
263
263
  border-top: 1px solid #EBEBEB;
@@ -267,14 +267,14 @@ select, textarea, input[type="text"], input[type="password"], input[type="dateti
267
267
  padding: 3px 0;
268
268
  text-align: center;
269
269
  text-decoration: none;
270
- }
270
+ }
271
271
  .top-menu .popover-content .popover_footer a:hover{
272
272
  background: none repeat scroll 0 0 #EDEDED;
273
273
  }
274
274
  /* hide bubble if the data attribute value is 0 */
275
275
  .top-menu li a[data-notification="0"]:after {
276
276
  display: none;
277
- }
277
+ }
278
278
  .top-menu li a[data-notification]:after {
279
279
  background-image: linear-gradient(bottom, rgb(199,24,33) 0%, rgb(245,71,71) 100%);
280
280
  background-image: -o-linear-gradient(bottom, rgb(199,24,33) 0%, rgb(245,71,71) 100%);
@@ -462,7 +462,7 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
462
462
  float: left;
463
463
  margin: 0 30px 15px 0;
464
464
  text-align: center;
465
- }
465
+ }
466
466
  .overview_boxes .box_row:last-child > div:last-child{
467
467
  margin-right:0;
468
468
  }
@@ -477,12 +477,12 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
477
477
  font-size: 26px;
478
478
  line-height: 30px;
479
479
  margin: 5px 0 0;
480
- }
480
+ }
481
481
  .overview_boxes p{
482
482
  color: #888;
483
483
  font-size:14px;
484
484
  margin: 0;
485
- }
485
+ }
486
486
  .overview_boxes .widget-tasks-statistics{
487
487
  margin-left:15px;
488
488
  }
@@ -503,8 +503,8 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
503
503
  /* Navbar */
504
504
  .navbar-fixed-top .navbar-inner{
505
505
  height: 45px;
506
- background: #292A2F;
507
- border: none;
506
+ background: #292A2F;
507
+ border: none;
508
508
  }
509
509
  .navbar-fixed-top .navbar-inner, .navbar-static-top .navbar-inner{
510
510
  box-shadow: none;
@@ -584,6 +584,12 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
584
584
  .b_F5C294:hover, .b_F5C294.active{
585
585
  border-left: 2px solid #F5C294;
586
586
  }
587
+ .b_D1B2D1:hover, .b_D1B2D1.active{
588
+ border-left: 2px solid #D1B2D1;
589
+ }
590
+ .b_99FFCC:hover, .b_99FFCC.active{
591
+ border-left: 2px solid #99FFCC;
592
+ }
587
593
 
588
594
  .accordion-heading{
589
595
  background: #292A2F;
@@ -789,7 +795,7 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
789
795
  /*margin-bottom: 15px; */
790
796
  -moz-border-radius: 3px 3px 3px 3px;
791
797
  -webkit-border-radius: 3px 3px 3px 3px;
792
- border-radius: 3px 3px 3px 3px;
798
+ border-radius: 3px 3px 3px 3px;
793
799
  overflow: hidden;
794
800
  }
795
801
 
@@ -846,8 +852,8 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
846
852
  }
847
853
  .widget-header .progress{
848
854
  margin: 14px 0px;
849
- width: 30%;
850
- position: absolute;
855
+ width: 30%;
856
+ position: absolute;
851
857
  right: 15px;
852
858
  }
853
859
  .widget-header a.widget-hidden i{
@@ -934,13 +940,13 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
934
940
  color:#555555;
935
941
  position: relative;
936
942
  /*margin-bottom: 15px;*/
937
- }
943
+ }
938
944
  .btn.btn-box span{
939
945
  display:block;
940
- }
946
+ }
941
947
  .btn.btn-small.btn-box{
942
948
  padding:10px 0;
943
- }
949
+ }
944
950
 
945
951
  /* custom bootstrap design */
946
952
  .btn{
@@ -1071,7 +1077,7 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1071
1077
  float:right;
1072
1078
  display:inline;
1073
1079
  color:#E28271;
1074
-
1080
+
1075
1081
  }
1076
1082
  .widget-analytics-small h5{
1077
1083
  font-size:12px;
@@ -1186,7 +1192,7 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1186
1192
  background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.25) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.25) 75%, transparent 75%, transparent);
1187
1193
  background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.25) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.25) 75%, transparent 75%, transparent);
1188
1194
  background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.25) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.25) 75%, transparent 75%, transparent);
1189
- background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.25) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.25) 75%, transparent 75%, transparent);
1195
+ background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.25) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.25) 75%, transparent 75%, transparent);
1190
1196
  }
1191
1197
 
1192
1198
 
@@ -1276,7 +1282,7 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1276
1282
  margin-right:10px;
1277
1283
  border-right: 1px solid #DDDDDD;
1278
1284
  width: 50px;
1279
- height: 50px;
1285
+ height: 50px;
1280
1286
  }
1281
1287
  .widget-tickets h4{
1282
1288
  font-size:15px;
@@ -1362,14 +1368,14 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1362
1368
  }
1363
1369
  label input {
1364
1370
  width: 100%;
1365
- }
1371
+ }
1366
1372
  label select {
1367
1373
  text-align:left;
1368
1374
  width: 100%;
1369
- }
1375
+ }
1370
1376
  .label {
1371
1377
  font-size: 9px!important;
1372
- }
1378
+ }
1373
1379
  .widget-padding .widget-body{
1374
1380
  padding:5px!important;
1375
1381
  }
@@ -1389,17 +1395,17 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1389
1395
  }
1390
1396
  .navbar-fixed-top{
1391
1397
  margin: 0!important;
1392
- }
1398
+ }
1393
1399
  .navbar-fixed-top .navbar-inner, .navbar-fixed-bottom .navbar-inner{
1394
1400
  padding: 0!important;
1395
- }
1401
+ }
1396
1402
  .overview_boxes .box_row > div{
1397
1403
  float: none!important;
1398
1404
  margin: 0 0 15px 0;
1399
1405
  }
1400
1406
  .heading .btn{
1401
1407
  font-size: 12px!important;
1402
- padding: 2px 8px;
1408
+ padding: 2px 8px;
1403
1409
  }
1404
1410
  .widget{
1405
1411
  margin-bottom:25px;
@@ -1466,11 +1472,11 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1466
1472
  label input {
1467
1473
  text-align:left;
1468
1474
  width: 100%;
1469
- }
1475
+ }
1470
1476
  label select {
1471
1477
  text-align:left;
1472
1478
  width: 100%;
1473
- }
1479
+ }
1474
1480
  .widget-padding .widget-body{
1475
1481
  padding:5px!important;
1476
1482
  }
@@ -1492,7 +1498,7 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1492
1498
  }
1493
1499
  .logo {
1494
1500
  margin: 0 0 0 15px;
1495
- }
1501
+ }
1496
1502
  .overview_boxes .box_row > div:last-child{
1497
1503
  margin-right: 0;
1498
1504
  }
@@ -1513,7 +1519,7 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1513
1519
  position: fixed;
1514
1520
  width: 150px;
1515
1521
  height: 100% !important;
1516
- background: #292A2F;
1522
+ background: #292A2F;
1517
1523
  left: -150px;
1518
1524
  }
1519
1525
  .main_container{
@@ -1528,7 +1534,7 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1528
1534
  }
1529
1535
  .logo {
1530
1536
  margin: 0 0 0 15px;
1531
- }
1537
+ }
1532
1538
  .overview_boxes .box_row > div:last-child{
1533
1539
  margin-right: 0;
1534
1540
  }
@@ -1538,7 +1544,7 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1538
1544
  position: fixed;
1539
1545
  width: 170px;
1540
1546
  height: 100% !important;
1541
- background: #292A2F;
1547
+ background: #292A2F;
1542
1548
  left: 0!important;
1543
1549
  }
1544
1550
  .main_container{
@@ -1547,7 +1553,7 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1547
1553
  }
1548
1554
  .logo {
1549
1555
  margin: 0 90px 0 15px;
1550
- }
1556
+ }
1551
1557
  .overview_boxes .box_row > div:last-child{
1552
1558
  margin-right: 0;
1553
1559
  }
@@ -1558,7 +1564,7 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1558
1564
  position: fixed;
1559
1565
  width: 200px;
1560
1566
  height: 100% !important;
1561
- background: #292A2F;
1567
+ background: #292A2F;
1562
1568
  left: 0!important;
1563
1569
  }
1564
1570
  .main_container{
@@ -1567,6 +1573,5 @@ table.table thead .sorting_desc_disabled { background: url('sort_desc_disabled.p
1567
1573
  }
1568
1574
  .logo {
1569
1575
  margin: 0 90px 0 15px;
1570
- }
1576
+ }
1571
1577
  }
1572
-
@@ -0,0 +1,71 @@
1
+ module Adminpanel
2
+ class CategoriesController < ApplicationController
3
+ def index
4
+ @categories = Category.all
5
+ end
6
+
7
+ def new
8
+ set_collections
9
+ new! do |format|
10
+ format.html { render "shared/new" }
11
+ format.js {render :locals => {:category => resource, :model => params[:model]}}
12
+ end
13
+ end
14
+
15
+
16
+ def create
17
+ create! do |success, failure|
18
+ success.html do
19
+ flash.now[:success] = I18n.t("action.save_success")
20
+ # render "shared/index"
21
+ redirect_to categories_path
22
+ end
23
+ failure.html do
24
+ set_collections
25
+ render "shared/new"
26
+ end
27
+
28
+ success.js do
29
+ render :locals => {:category => resource }
30
+
31
+ end
32
+ failure.js do
33
+ set_collections
34
+ render "new", :locals => {:category => resource, :model => resource.model }, :formats => [:js]
35
+
36
+ end
37
+ end
38
+ end
39
+
40
+ def edit
41
+ edit! do |format|
42
+ format.html do
43
+ set_collections
44
+ render "shared/edit"
45
+ end
46
+ end
47
+ end
48
+
49
+ def update
50
+ update! do |success, failure|
51
+ success.html do
52
+ flash.now[:success] = I18n.t("action.save_success")
53
+ # render "shared/index"
54
+ redirect_to categories_path
55
+ end
56
+ failure.html do
57
+ set_collections
58
+ render "shared/edit"
59
+ end
60
+ end
61
+ end
62
+
63
+ def destroy
64
+ destroy! do |format|
65
+ format.html do
66
+ redirect_to categories_path
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -2,84 +2,84 @@ module Adminpanel
2
2
  class UsersController < Adminpanel::ApplicationController
3
3
  # GET /admin/users
4
4
  # GET /admin/users.json
5
- def index
6
- @users = User.all
7
-
8
- respond_to do |format|
9
- format.html # index.html.erb
10
- format.json { render :json => @users }
11
- end
12
- end
5
+ # def index
6
+ # @users = User.all
7
+ #
8
+ # respond_to do |format|
9
+ # format.html # index.html.erb
10
+ # format.json { render :json => @users }
11
+ # end
12
+ # end
13
13
 
14
14
  # GET /admin/users/1
15
15
  # GET /admin/users/1.json
16
- def show
17
- @user = User.find(params[:id])
18
-
19
- respond_to do |format|
20
- format.html # show.html.erb
21
- format.json { render :json => @user }
22
- end
23
- end
24
-
25
- # GET /admin/users/new
26
- # GET /admin/users/new.json
27
- def new
28
- @user = User.new
29
-
30
- respond_to do |format|
31
- format.html # new.html.erb
32
- format.json { render :json => @user }
33
- end
34
- end
16
+ # def show
17
+ # @user = User.find(params[:id])
18
+ #
19
+ # respond_to do |format|
20
+ # format.html # show.html.erb
21
+ # format.json { render :json => @user }
22
+ # end
23
+ # end
24
+ #
25
+ # # GET /admin/users/new
26
+ # # GET /admin/users/new.json
27
+ # def new
28
+ # @user = User.new
29
+ #
30
+ # respond_to do |format|
31
+ # format.html # new.html.erb
32
+ # format.json { render :json => @user }
33
+ # end
34
+ # end
35
35
 
36
36
  # GET /admin/users/1/edit
37
- def edit
38
- @user = User.find(params[:id])
39
- end
40
-
41
- # POST /admin/users
42
- # POST /admin/users.json
43
- def create
44
- @user = User.new(params[:user])
45
-
46
- respond_to do |format|
47
- if @user.save
48
- format.html { redirect_to @user, :notice => t("user.success") }
49
- format.json { render :json => @user, :status => :created, :location => @user }
50
- else
51
- format.html { render :action => "new" }
52
- format.json { render :json => @user.errors, :status => :unprocessable_entity }
53
- end
54
- end
55
- end
37
+ # def edit
38
+ # @user = User.find(params[:id])
39
+ # end
40
+ #
41
+ # # POST /admin/users
42
+ # # POST /admin/users.json
43
+ # def create
44
+ # @user = User.new(params[:user])
45
+ #
46
+ # respond_to do |format|
47
+ # if @user.save
48
+ # format.html { redirect_to @user, :notice => t("user.success") }
49
+ # format.json { render :json => @user, :status => :created, :location => @user }
50
+ # else
51
+ # format.html { render :action => "new" }
52
+ # format.json { render :json => @user.errors, :status => :unprocessable_entity }
53
+ # end
54
+ # end
55
+ # end
56
56
 
57
57
  # PUT /admin/users/1
58
58
  # PUT /admin/users/1.json
59
- def update
60
- @user = User.find(params[:id])
61
-
62
- respond_to do |format|
63
- if @user.update_attributes(params[:user])
64
- format.html { redirect_to @user, :notice => 'Se ha actualizado con exito.' }
65
- format.json { head :no_content }
66
- else
67
- format.html { render :action => "edit" }
68
- format.json { render :json => @user.errors, :status => :unprocessable_entity }
69
- end
70
- end
71
- end
59
+ # def update
60
+ # @user = User.find(params[:id])
61
+ #
62
+ # respond_to do |format|
63
+ # if @user.update_attributes(params[:user])
64
+ # format.html { redirect_to @user, :notice => 'Se ha actualizado con exito.' }
65
+ # format.json { head :no_content }
66
+ # else
67
+ # format.html { render :action => "edit" }
68
+ # format.json { render :json => @user.errors, :status => :unprocessable_entity }
69
+ # end
70
+ # end
71
+ # end
72
72
 
73
73
  # DELETE /admin/users/1
74
74
  # DELETE /admin/users/1.json
75
- def destroy
76
- @user = User.find(params[:id])
77
- @user.destroy
78
-
79
- respond_to do |format|
80
- format.html { redirect_to users_url }
81
- format.json { head :no_content }
82
- end
83
- end
75
+ # def destroy
76
+ # @user = User.find(params[:id])
77
+ # @user.destroy
78
+ #
79
+ # respond_to do |format|
80
+ # format.html { redirect_to users_url }
81
+ # format.json { head :no_content }
82
+ # end
83
+ # end
84
84
  end
85
- end
85
+ end