kuppayam 0.1.0 → 0.1.1
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/README.md +27 -4
- data/app/assets/javascripts/kuppayam/utilities.js +110 -5
- data/app/assets/javascripts/kuppayam.js +4 -0
- data/app/assets/stylesheets/kuppayam/custom.css +48 -1
- data/app/assets/stylesheets/kuppayam.css +1 -0
- data/app/assets/stylesheets/wysiwyg-color.css +15 -0
- data/app/controllers/kuppayam/base_controller.rb +24 -3
- data/app/controllers/kuppayam/documents_controller.rb +104 -0
- data/app/controllers/kuppayam/images_controller.rb +104 -0
- data/app/controllers/kuppayam/import_data_controller.rb +34 -0
- data/app/controllers/kuppayam/resource_controller.rb +9 -0
- data/app/helpers/breadcrumbs_helper.rb +32 -15
- data/app/helpers/document_helper.rb +40 -0
- data/app/helpers/flash_helper.rb +0 -8
- data/app/helpers/image_helper.rb +57 -88
- data/app/helpers/notification_helper.rb +41 -0
- data/app/helpers/render_helper.rb +44 -5
- data/app/helpers/resource_helper.rb +107 -52
- data/app/models/document/base.rb +43 -0
- data/app/models/image/base.rb +52 -0
- data/app/models/import_data.rb +20 -0
- data/app/models/kuppayam/application_record.rb +5 -0
- data/app/uploaders/document_uploader.rb +15 -0
- data/app/uploaders/image_uploader.rb +90 -0
- data/app/views/kuppayam/documents/_crop_form.html.erb +44 -0
- data/app/views/kuppayam/documents/_form.html.erb +47 -0
- data/app/views/kuppayam/documents/_new.html.erb +9 -0
- data/app/views/kuppayam/documents/_photos.html.erb +16 -0
- data/app/views/kuppayam/documents/create.html.erb +14 -0
- data/app/views/kuppayam/documents/crop.html.erb +9 -0
- data/app/views/kuppayam/documents/edit.js.erb +7 -0
- data/app/views/kuppayam/documents/new.js.erb +7 -0
- data/app/views/kuppayam/documents/update.html.erb +14 -0
- data/app/views/kuppayam/images/_action_buttons.html.erb +14 -0
- data/app/views/kuppayam/images/_crop_form.html.erb +44 -0
- data/app/views/kuppayam/images/_form.html.erb +56 -0
- data/app/views/kuppayam/images/_index.html.erb +49 -0
- data/app/views/kuppayam/images/_new.html.erb +9 -0
- data/app/views/kuppayam/images/_photos.html.erb +16 -0
- data/app/views/kuppayam/images/_row.html.erb +65 -0
- data/app/views/kuppayam/images/create.html.erb +38 -0
- data/app/views/kuppayam/images/crop.html.erb +9 -0
- data/app/views/kuppayam/images/edit.js.erb +8 -0
- data/app/views/kuppayam/images/index.html.erb +26 -0
- data/app/views/kuppayam/images/new.js.erb +8 -0
- data/app/views/kuppayam/images/update.html.erb +38 -0
- data/app/views/kuppayam/import_data/_form.html.erb +38 -0
- data/app/views/kuppayam/import_data/_new.html.erb +9 -0
- data/app/views/kuppayam/import_data/_photos.html.erb +16 -0
- data/app/views/kuppayam/import_data/create.html.erb +14 -0
- data/app/views/kuppayam/import_data/crop.html.erb +9 -0
- data/app/views/kuppayam/import_data/edit.js.erb +7 -0
- data/app/views/kuppayam/import_data/new.js.erb +11 -0
- data/app/views/kuppayam/import_data/update.html.erb +14 -0
- data/app/views/kuppayam/workflows/parrot/_info.html.erb +15 -0
- data/app/views/kuppayam/workflows/parrot/create.js.erb +36 -0
- data/app/views/kuppayam/workflows/parrot/destroy.js.erb +22 -0
- data/app/views/kuppayam/workflows/parrot/edit.js.erb +10 -0
- data/app/views/kuppayam/workflows/parrot/index.js.erb +14 -0
- data/app/views/kuppayam/workflows/parrot/new.js.erb +9 -0
- data/app/views/kuppayam/workflows/parrot/row.js.erb +24 -0
- data/app/views/kuppayam/workflows/parrot/show.js.erb +13 -0
- data/app/views/kuppayam/workflows/parrot/update.js.erb +34 -0
- data/app/views/kuppayam/workflows/peacock/_info.html.erb +15 -0
- data/app/views/kuppayam/workflows/peacock/create.js.erb +36 -0
- data/app/views/kuppayam/workflows/peacock/destroy.js.erb +22 -0
- data/app/views/kuppayam/workflows/peacock/edit.js.erb +10 -0
- data/app/views/kuppayam/workflows/peacock/index.js.erb +14 -0
- data/app/views/kuppayam/workflows/peacock/new.js.erb +9 -0
- data/app/views/kuppayam/workflows/peacock/row.js.erb +24 -0
- data/app/views/kuppayam/workflows/peacock/show.js.erb +13 -0
- data/app/views/kuppayam/workflows/peacock/update.js.erb +34 -0
- data/app/views/layouts/kuppayam/_heading.html.erb +4 -4
- data/app/views/layouts/kuppayam/_navbar.html.erb +1 -1
- data/app/views/layouts/kuppayam/_overlays.html.erb +7 -0
- data/app/views/layouts/kuppayam/_sidebar.html.erb +19 -1
- data/app/views/layouts/kuppayam/admin.html.erb +4 -0
- data/app/views/layouts/kuppayam/document_upload.html.erb +16 -0
- data/app/views/layouts/kuppayam/image_upload.html.erb +16 -0
- data/config/initializers/inflections.rb +3 -0
- data/config/locales/kuppayam/general.yml +29 -0
- data/config/routes.rb +15 -0
- data/db/migrate/20170000000000_create_images.rb +13 -0
- data/db/migrate/20170000000001_create_documents.rb +13 -0
- data/db/migrate/20170000000002_create_import_data.rb +14 -0
- data/lib/kuppayam/action_view/form_helper.rb +23 -4
- data/lib/kuppayam/action_view/theme_helper.rb +2 -2
- data/lib/kuppayam/engine.rb +11 -14
- data/lib/kuppayam/version.rb +1 -1
- metadata +75 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 226b20bec299245b0c8f99d93a0af90a10cae6fc
|
|
4
|
+
data.tar.gz: 95ce7b1401fe1cd1b4f65257cb4d00b19a9fe847
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ed223ebb3475a8e2622fbea00a77c3c7305c82a9f7ffc5c06770ff9140df32fd3852eb5cbab797ee228274c8d893133cf13bdf04a76e6921a03c7ff8cc453a9a
|
|
7
|
+
data.tar.gz: 133d8d7ebabd51088953c0d87eb7d7d68b5c830b768b1efa5fce86b61e1f52ebeaeeedc145ed6e2bfebec606e468b200c9f26fbde4a31dad0f0b0de30c9e995a
|
data/README.md
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
# Kuppayam
|
|
2
|
-
Short description and motivation.
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Kuppayam is a basic UI to starter kit.
|
|
4
|
+
|
|
5
|
+
A basic UI starter kit - rails engine with useful helpers and bootstrap based UI modules
|
|
6
|
+
|
|
7
|
+
## How to use Kuppayam?
|
|
8
|
+
|
|
9
|
+
just add kuppayam to gemfile and you are done.
|
|
6
10
|
|
|
7
11
|
## Installation
|
|
12
|
+
|
|
8
13
|
Add this line to your application's Gemfile:
|
|
9
14
|
|
|
10
15
|
```ruby
|
|
@@ -22,7 +27,25 @@ $ gem install kuppayam
|
|
|
22
27
|
```
|
|
23
28
|
|
|
24
29
|
## Contributing
|
|
25
|
-
|
|
30
|
+
|
|
31
|
+
Fork the project from the repository https://github.com/right-solutions/kuppayam
|
|
32
|
+
|
|
33
|
+
Make your changes & Send a Pull Request.
|
|
34
|
+
|
|
35
|
+
## Gem Release Instructions
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
$ gem build kuppayam.gemspec
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
$ gem push gem push kuppayam-0.1.1.gem
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
|
|
26
46
|
|
|
27
47
|
## License
|
|
28
48
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// loadANewPage will accept a url and will load a new page
|
|
2
2
|
// It can be tuned to show a lightbox showing a loading, please wait message.
|
|
3
3
|
function loadANewPage(url){
|
|
4
|
-
// showLightBoxLoading();
|
|
5
4
|
window.location.href=url;
|
|
6
5
|
}
|
|
7
6
|
|
|
@@ -17,18 +16,42 @@ var messageModalId = "div_modal_message";
|
|
|
17
16
|
|
|
18
17
|
// Call this function by passing model Id, heading and a bodyContent.
|
|
19
18
|
// it will pop up bootstrap 3 modal.
|
|
20
|
-
function showGenericModal(heading, bodyContent){
|
|
19
|
+
function showGenericModal(heading, bodyContent, showHeading=true){
|
|
21
20
|
$('#' + genericModalId + ' .modal-header .modal-title').text(heading);
|
|
22
21
|
$('#' + genericModalId + ' div.modal-body-main').html(bodyContent);
|
|
23
22
|
$('#' + genericModalId).modal({show: true, backdrop: 'static', keyboard: false});
|
|
23
|
+
|
|
24
|
+
if(showHeading){
|
|
25
|
+
$('#' + genericModalId + ' .modal-header').show();
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
$('#' + genericModalId + ' .modal-header').hide();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setTimeout(function() {
|
|
32
|
+
$('#' + genericModalId).modal('handleUpdate'); //Update backdrop on modal show
|
|
33
|
+
$('#' + genericModalId).scrollTop(0); //reset modal to top position
|
|
34
|
+
}, 1000);
|
|
24
35
|
}
|
|
25
36
|
|
|
26
37
|
// Call this function by passing model Id, heading and a bodyContent.
|
|
27
38
|
// it will pop up bootstrap 3 modal.
|
|
28
|
-
function showLargeModal(heading, bodyContent){
|
|
39
|
+
function showLargeModal(heading, bodyContent, showHeading=true){
|
|
29
40
|
$('#' + largeModalId + ' .modal-header .modal-title').text(heading);
|
|
30
41
|
$('#' + largeModalId + ' div.modal-body-main').html(bodyContent);
|
|
31
42
|
$('#' + largeModalId).modal({show: true, backdrop: 'static', keyboard: false});
|
|
43
|
+
|
|
44
|
+
if(showHeading){
|
|
45
|
+
$('#' + largeModalId + ' .modal-header').show();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
$('#' + largeModalId + ' .modal-header').hide();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
setTimeout(function() {
|
|
52
|
+
$('#' + largeModalId).modal('handleUpdate'); //Update backdrop on modal show
|
|
53
|
+
$('#' + largeModalId).scrollTop(0); //reset modal to top position
|
|
54
|
+
}, 1000);
|
|
32
55
|
}
|
|
33
56
|
|
|
34
57
|
// Call this function by passing heading and a message.
|
|
@@ -39,24 +62,106 @@ function showMessageModal(heading, message, modalId){
|
|
|
39
62
|
}
|
|
40
63
|
var bodyContent = "<p>"+ message +"</p>";
|
|
41
64
|
//$('#' + modalId + ' .modal-body').html("<p>"+ message +"</p>");
|
|
42
|
-
$('#' + modalId + ' .modal-header
|
|
65
|
+
$('#' + modalId + ' .modal-header .modal-title').text(heading);
|
|
43
66
|
$('#' + modalId + ' div.modal-body').html(bodyContent);
|
|
44
67
|
$('#' + modalId).modal({show: true, backdrop: 'static', keyboard: false});
|
|
45
68
|
//$('#' + modalId + ' .modal-footer button.btn-primary').button('reset');
|
|
69
|
+
setTimeout(function() {
|
|
70
|
+
$('#' + modalId).modal('handleUpdate'); //Update backdrop on modal show
|
|
71
|
+
$('#' + modalId).scrollTop(0); //reset modal to top position
|
|
72
|
+
}, 1000);
|
|
46
73
|
}
|
|
47
74
|
|
|
48
75
|
function closeGenericModal(modalId){
|
|
49
76
|
$('#' + genericModalId).modal('hide');
|
|
77
|
+
|
|
78
|
+
showAndHideModals();
|
|
50
79
|
}
|
|
51
80
|
|
|
52
81
|
function closeLargeModal(modalId){
|
|
53
|
-
$('#' + largeModalId).modal('hide');
|
|
82
|
+
$('#' + largeModalId).modal('hide');
|
|
54
83
|
}
|
|
55
84
|
|
|
56
85
|
function closeMessageModal(modalId){
|
|
57
86
|
$('#' + messageModalId).modal('hide');
|
|
87
|
+
|
|
88
|
+
showAndHideModals();
|
|
58
89
|
}
|
|
59
90
|
|
|
91
|
+
function showAndHideModals(){
|
|
92
|
+
// Just hide and show other modals as there could
|
|
93
|
+
// be a problem with scrolling due to overlapping
|
|
94
|
+
// of 2 or more modals
|
|
95
|
+
if( ($('#' + largeModalId).data('bs.modal') || {}).isShown == true ) {
|
|
96
|
+
$('#' + largeModalId).modal('hide');
|
|
97
|
+
$('#' + largeModalId).modal('show');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if( ($('#' + genericModalId).data('bs.modal') || {}).isShown == true ) {
|
|
101
|
+
$('#' + genericModalId).modal('hide');
|
|
102
|
+
$('#' + genericModalId).modal('show');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function notifySuccess(title, message){
|
|
107
|
+
var opts = {
|
|
108
|
+
"closeButton": true,
|
|
109
|
+
"debug": false,
|
|
110
|
+
"positionClass": "toast-bottom-right",
|
|
111
|
+
"onclick": null,
|
|
112
|
+
"showDuration": "300",
|
|
113
|
+
"hideDuration": "1000",
|
|
114
|
+
"timeOut": "5000",
|
|
115
|
+
"extendedTimeOut": "1000",
|
|
116
|
+
"showEasing": "swing",
|
|
117
|
+
"hideEasing": "linear",
|
|
118
|
+
"showMethod": "fadeIn",
|
|
119
|
+
"hideMethod": "fadeOut"
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
toastr.success(message, title, opts);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function notifyError(title, message){
|
|
126
|
+
var opts = {
|
|
127
|
+
"closeButton": true,
|
|
128
|
+
"debug": false,
|
|
129
|
+
"positionClass": "toast-bottom-right",
|
|
130
|
+
"onclick": null,
|
|
131
|
+
"showDuration": "300",
|
|
132
|
+
"hideDuration": "1000",
|
|
133
|
+
"timeOut": "5000",
|
|
134
|
+
"extendedTimeOut": "1000",
|
|
135
|
+
"showEasing": "swing",
|
|
136
|
+
"hideEasing": "linear",
|
|
137
|
+
"showMethod": "fadeIn",
|
|
138
|
+
"hideMethod": "fadeOut"
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
toastr.error(message, title, opts);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function notifyInfo(title, message){
|
|
145
|
+
var opts = {
|
|
146
|
+
"closeButton": true,
|
|
147
|
+
"debug": false,
|
|
148
|
+
"positionClass": "toast-bottom-right",
|
|
149
|
+
"onclick": null,
|
|
150
|
+
"showDuration": "300",
|
|
151
|
+
"hideDuration": "1000",
|
|
152
|
+
"timeOut": "5000",
|
|
153
|
+
"extendedTimeOut": "1000",
|
|
154
|
+
"showEasing": "swing",
|
|
155
|
+
"hideEasing": "linear",
|
|
156
|
+
"showMethod": "fadeIn",
|
|
157
|
+
"hideMethod": "fadeOut"
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
toastr.info(message, title, opts);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
60
165
|
// function initPopovers(){
|
|
61
166
|
// $('[data-toggle="popover"]').popover()
|
|
62
167
|
// }
|
|
@@ -5,4 +5,51 @@
|
|
|
5
5
|
// Overriding it to white
|
|
6
6
|
.alert {color: #fff !important}
|
|
7
7
|
.alert p {color: #fff !important}
|
|
8
|
-
.alert .close {color: #fff !important}
|
|
8
|
+
.alert .close {color: #fff !important}
|
|
9
|
+
|
|
10
|
+
.btn.btn-default.btn-only-hover,
|
|
11
|
+
.btn.btn-white.btn-only-hover,
|
|
12
|
+
.btn.btn-danger.btn-only-hover,
|
|
13
|
+
.btn.btn-success.btn-only-hover,
|
|
14
|
+
.btn.btn-primary.btn-only-hover,
|
|
15
|
+
.btn.btn-gray.btn-only-hover,
|
|
16
|
+
.btn.btn-secondary.btn-only-hover {
|
|
17
|
+
background-color: #fff !important;
|
|
18
|
+
color: #333 !important;
|
|
19
|
+
border: 1px solid #ddd !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.btn.btn-danger.btn-only-hover:hover{
|
|
23
|
+
background-color: #f2f2f2 !important;
|
|
24
|
+
color: #333 !important;
|
|
25
|
+
border: 1px solid #ddd !important;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.btn.btn-danger.btn-only-hover:hover{
|
|
29
|
+
background-color: #cc3f44 !important;
|
|
30
|
+
color: #fff !important;
|
|
31
|
+
border: 1px solid #bf3338 !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.btn.btn-success.btn-only-hover:hover{
|
|
35
|
+
color: #fff !important;
|
|
36
|
+
background-color: #72a230 !important;
|
|
37
|
+
border-color: #5f8628 !important;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.btn.btn-gray.btn-only-hover:hover{
|
|
41
|
+
background-color: #eee !important;
|
|
42
|
+
color: #333 !important;
|
|
43
|
+
border-color: #202122 !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.btn.btn-primary.btn-only-hover:hover{
|
|
47
|
+
background-color: #2c2e2f !important;
|
|
48
|
+
color: #fff !important;
|
|
49
|
+
border: 1px solid #202122 !important;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.btn.btn-secondary.btn-only-hover:hover{
|
|
53
|
+
background-color: #68b828 !important;
|
|
54
|
+
color: #fff !important;
|
|
55
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
+
* It is generally better to create a new file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require wysihtml5/lib/css/wysiwyg-color.css
|
|
14
|
+
|
|
15
|
+
*/
|
|
@@ -2,17 +2,19 @@ module Kuppayam
|
|
|
2
2
|
class BaseController < ActionController::Base
|
|
3
3
|
|
|
4
4
|
protect_from_forgery with: :exception
|
|
5
|
+
rescue_from ActionController::InvalidAuthenticityToken, :with => :handle_invalid_authenticity_token
|
|
5
6
|
|
|
6
7
|
layout 'kuppayam/admin'
|
|
7
8
|
|
|
8
|
-
before_action :stylesheet_filename, :javascript_filename,
|
|
9
|
+
before_action :set_locale, :stylesheet_filename, :javascript_filename,
|
|
9
10
|
:set_default_title, :set_navs, :parse_pagination_params,
|
|
10
|
-
:configure_filters
|
|
11
|
+
:configure_filters, :configure_notification, :configure_breadcrumbs
|
|
11
12
|
|
|
12
13
|
include ParamsParserHelper
|
|
13
14
|
include RenderHelper
|
|
14
|
-
|
|
15
|
+
|
|
15
16
|
include FlashHelper
|
|
17
|
+
include NotificationHelper
|
|
16
18
|
include MetaTagsHelper
|
|
17
19
|
include NavigationHelper
|
|
18
20
|
include BreadcrumbsHelper
|
|
@@ -23,6 +25,25 @@ module Kuppayam
|
|
|
23
25
|
|
|
24
26
|
private
|
|
25
27
|
|
|
28
|
+
# Setting the Locale from User Preferences
|
|
29
|
+
# With this approach, http://localhost:3000?locale=pt
|
|
30
|
+
# renders the Portuguese localization, while
|
|
31
|
+
# http://localhost:3000?locale=de
|
|
32
|
+
# loads a German localization.
|
|
33
|
+
def set_locale
|
|
34
|
+
I18n.locale = params[:locale] || I18n.default_locale
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Every helper method dependent on url_for
|
|
38
|
+
# (e.g. helpers for named routes like root_path
|
|
39
|
+
# or root_url, resource routes like books_path
|
|
40
|
+
# or books_url, etc.) will now automatically
|
|
41
|
+
# include the locale in the query string,
|
|
42
|
+
# like this: http://localhost:3001/?locale=ja.
|
|
43
|
+
def default_url_options
|
|
44
|
+
{ locale: I18n.locale }
|
|
45
|
+
end
|
|
46
|
+
|
|
26
47
|
def stylesheet_filename
|
|
27
48
|
@stylesheet_filename = "kuppayam"
|
|
28
49
|
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
module Kuppayam
|
|
2
|
+
class DocumentsController < Kuppayam::ResourceController
|
|
3
|
+
|
|
4
|
+
before_action :get_document_class
|
|
5
|
+
before_action :get_resource
|
|
6
|
+
|
|
7
|
+
def index
|
|
8
|
+
get_collections
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def show
|
|
12
|
+
@document = @document_class.find(params[:id])
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def new
|
|
16
|
+
@document = @document_class.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def edit
|
|
20
|
+
@document = @document_class.find(params[:id])
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create
|
|
24
|
+
@document = @document_class.new
|
|
25
|
+
@document.documentable = @resource
|
|
26
|
+
@document.document = params[:document]
|
|
27
|
+
@document.save
|
|
28
|
+
set_flash_message("Document has been created successfully", :success)
|
|
29
|
+
render layout: "kuppayam/document_upload"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def update
|
|
33
|
+
@document = @document_class.find(params[:id])
|
|
34
|
+
@document.document = params[:document]
|
|
35
|
+
@document.save
|
|
36
|
+
set_flash_message("Document has been updated successfully", :success)
|
|
37
|
+
render layout: "kuppayam/document_upload"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def crop
|
|
41
|
+
@document = @document_class.find(params[:id])
|
|
42
|
+
@document.assign_attributes(document_params)
|
|
43
|
+
@document.document = params[:document]
|
|
44
|
+
@document.save
|
|
45
|
+
set_flash_message("Document has been cropped successfully", :success)
|
|
46
|
+
render layout: "kuppayam/document_upload"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def document_params
|
|
52
|
+
params.require(:document).permit(:crop_x, :crop_y, :crop_w, :crop_h, :document)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def get_document_class
|
|
56
|
+
@document_type = params[:document_type]
|
|
57
|
+
@document_class = @document_type.constantize if @document_type
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def get_resource
|
|
61
|
+
@resource = params[:documentable_type].constantize.find(params[:documentable_id]) if params[:documentable_type] && params[:documentable_id]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def save_document
|
|
65
|
+
@document = @document_class.new
|
|
66
|
+
@document.documentable = @resource
|
|
67
|
+
@document.document = params[:document][:document]
|
|
68
|
+
@document.save
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def get_collections
|
|
72
|
+
@relation = Document::Base.where("")
|
|
73
|
+
parse_filters
|
|
74
|
+
apply_filters
|
|
75
|
+
@documents = @relation.page(@current_page).per(@per_page)
|
|
76
|
+
return true
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def apply_filters
|
|
80
|
+
@relation = @relation.search(@query) if @query
|
|
81
|
+
|
|
82
|
+
@order_by = "created_at desc" unless @order_by
|
|
83
|
+
@relation = @relation.order(@order_by)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def configure_filter_settings
|
|
87
|
+
@filter_settings = {
|
|
88
|
+
string_filters: [
|
|
89
|
+
{ filter_name: :query }
|
|
90
|
+
],
|
|
91
|
+
|
|
92
|
+
boolean_filters: [],
|
|
93
|
+
|
|
94
|
+
reference_filters: [],
|
|
95
|
+
variable_filters: [],
|
|
96
|
+
}
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def configure_filter_ui_settings
|
|
100
|
+
@filter_ui_settings = {}
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
104
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
module Kuppayam
|
|
2
|
+
class ImagesController < Kuppayam::ResourceController
|
|
3
|
+
|
|
4
|
+
before_action :get_image_class
|
|
5
|
+
before_action :get_resource
|
|
6
|
+
|
|
7
|
+
def index
|
|
8
|
+
get_collections
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def show
|
|
12
|
+
@image = @image_class.find(params[:id])
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def new
|
|
16
|
+
@image = @image_class.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def edit
|
|
20
|
+
@image = @image_class.find(params[:id])
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create
|
|
24
|
+
@image = @image_class.new
|
|
25
|
+
@image.imageable = @resource
|
|
26
|
+
@image.image = params[:image]
|
|
27
|
+
@image.save if @image.valid?
|
|
28
|
+
set_flash_message("Image has been created successfully", :success)
|
|
29
|
+
render layout: "kuppayam/image_upload"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def update
|
|
33
|
+
@image = @image_class.find(params[:id])
|
|
34
|
+
@image.image = params[:image]
|
|
35
|
+
@image.save
|
|
36
|
+
set_flash_message("Image has been updated successfully", :success)
|
|
37
|
+
render layout: "kuppayam/image_upload"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def crop
|
|
41
|
+
@image = @image_class.find(params[:id])
|
|
42
|
+
@image.assign_attributes(permitted_params)
|
|
43
|
+
@image.image = params[:image]
|
|
44
|
+
@image.save
|
|
45
|
+
set_flash_message("Image has been cropped successfully", :success)
|
|
46
|
+
render layout: "kuppayam/image_upload"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def permitted_params
|
|
52
|
+
params.require(:image).permit(:crop_x, :crop_y, :crop_w, :crop_h, :image)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def get_image_class
|
|
56
|
+
@image_type = params[:image_type]
|
|
57
|
+
@image_class = @image_type.constantize if @image_type
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def get_resource
|
|
61
|
+
@resource = params[:imageable_type].constantize.find(params[:imageable_id]) if params[:imageable_type] && params[:imageable_id]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def save_image
|
|
65
|
+
@image = @image_class.new
|
|
66
|
+
@image.imageable = @resource
|
|
67
|
+
@image.image = params[:image][:image]
|
|
68
|
+
@image.save
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def get_collections
|
|
72
|
+
@relation = Image::Base.where("")
|
|
73
|
+
parse_filters
|
|
74
|
+
apply_filters
|
|
75
|
+
@images = @relation.page(@current_page).per(@per_page)
|
|
76
|
+
return true
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def apply_filters
|
|
80
|
+
@relation = @relation.search(@query) if @query
|
|
81
|
+
|
|
82
|
+
@order_by = "created_at desc" unless @order_by
|
|
83
|
+
@relation = @relation.order(@order_by)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def configure_filter_settings
|
|
87
|
+
@filter_settings = {
|
|
88
|
+
string_filters: [
|
|
89
|
+
{ filter_name: :query }
|
|
90
|
+
],
|
|
91
|
+
|
|
92
|
+
boolean_filters: [],
|
|
93
|
+
|
|
94
|
+
reference_filters: [],
|
|
95
|
+
variable_filters: [],
|
|
96
|
+
}
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def configure_filter_ui_settings
|
|
100
|
+
@filter_ui_settings = {}
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
104
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Kuppayam
|
|
2
|
+
class ImportDataController < Kuppayam::ResourceController
|
|
3
|
+
|
|
4
|
+
private
|
|
5
|
+
|
|
6
|
+
def permitted_params
|
|
7
|
+
params.require(:document).permit(:document)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def get_collections
|
|
11
|
+
@relation = ImportData.where("")
|
|
12
|
+
@events = @relation.page(@current_page).per(@per_page)
|
|
13
|
+
return true
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def resource_url(obj)
|
|
17
|
+
import_data_url(obj)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def configure_resource_controller
|
|
21
|
+
@resource_options = {
|
|
22
|
+
collection_name: :import_datas,
|
|
23
|
+
item_name: :import_data,
|
|
24
|
+
class: ImportData
|
|
25
|
+
}
|
|
26
|
+
super
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def set_navs
|
|
30
|
+
set_nav("import_data")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -1,25 +1,42 @@
|
|
|
1
1
|
module BreadcrumbsHelper
|
|
2
2
|
|
|
3
|
+
def breadcrumbs_configuration
|
|
4
|
+
{}
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def default_breadcrumbs_configuration
|
|
8
|
+
{
|
|
9
|
+
heading: "Heading",
|
|
10
|
+
description: "Description for the Page",
|
|
11
|
+
links: [{name: "Home", link: "#", icon: 'fa-home'},
|
|
12
|
+
{name: "Current Page", link: "#", icon: 'fa-calendar', active: true}]
|
|
13
|
+
}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def configure_breadcrumbs
|
|
17
|
+
@breadcrumbs = breadcrumbs_configuration
|
|
18
|
+
@breadcrumbs.reverse_merge!(default_breadcrumbs_configuration)
|
|
19
|
+
end
|
|
20
|
+
|
|
3
21
|
# Initialize @links in your controller action
|
|
4
22
|
def breadcrumb
|
|
5
|
-
@links
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
link_to(raw("#{i_tag} #{item[:name]}"), item[:link] )
|
|
23
|
+
if @breadcrumbs && @breadcrumbs.has_key?(:links) && @breadcrumbs[:links].any?
|
|
24
|
+
content_tag(:div, class: "breadcrumb-env") do
|
|
25
|
+
content_tag(:ol, class: "breadcrumb bc-1") do
|
|
26
|
+
li_array = []
|
|
27
|
+
@breadcrumbs[:links].each do |item|
|
|
28
|
+
li_class = item[:active] == true ? "active" : ""
|
|
29
|
+
li_array << content_tag(:li, class: li_class) do
|
|
30
|
+
i_tag = item.has_key?(:icon) ? "<i class='#{item[:icon]}'></i>" : ""
|
|
31
|
+
if item[:active]
|
|
32
|
+
raw("#{i_tag}<strong>#{item[:name]}</strong>")
|
|
33
|
+
else
|
|
34
|
+
link_to(raw("#{i_tag} #{item[:name]}"), item[:link] )
|
|
35
|
+
end
|
|
19
36
|
end
|
|
20
37
|
end
|
|
38
|
+
raw(li_array.join(" "))
|
|
21
39
|
end
|
|
22
|
-
raw(li_array.join(" "))
|
|
23
40
|
end
|
|
24
41
|
end
|
|
25
42
|
end
|