red_base 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +339 -0
- data/README.rdoc +40 -0
- data/Rakefile +42 -0
- data/app/assets/fonts/DroidNaskh-Bold.ttf +0 -0
- data/app/assets/fonts/DroidNaskh-Regular.ttf +0 -0
- data/app/assets/fonts/OpenSans-Bold.ttf +0 -0
- data/app/assets/fonts/OpenSans-BoldItalic.ttf +0 -0
- data/app/assets/fonts/OpenSans-ExtraBold.ttf +0 -0
- data/app/assets/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- data/app/assets/fonts/OpenSans-Italic.ttf +0 -0
- data/app/assets/fonts/OpenSans-Light.ttf +0 -0
- data/app/assets/fonts/OpenSans-LightItalic.ttf +0 -0
- data/app/assets/fonts/OpenSans-Regular.ttf +0 -0
- data/app/assets/fonts/OpenSans-Semibold.ttf +0 -0
- data/app/assets/fonts/OpenSans-SemiboldItalic.ttf +0 -0
- data/app/assets/javascripts/red_base/application.js +20 -0
- data/app/assets/javascripts/red_base/dashboard/angular.js +9 -0
- data/app/assets/javascripts/red_base/dashboard/app.js +65 -0
- data/app/assets/javascripts/red_base/dashboard/application.js.erb +24 -0
- data/app/assets/javascripts/red_base/dashboard/functions.js.erb +91 -0
- data/app/assets/javascripts/red_base/dashboard/init.js +38 -0
- data/app/assets/javascripts/red_base/dashboard/init.js~ +0 -0
- data/app/assets/javascripts/red_base/dashboard/lib/angular-animate.js +1226 -0
- data/app/assets/javascripts/red_base/dashboard/lib/angular-gettext.js +202 -0
- data/app/assets/javascripts/red_base/dashboard/lib/angular-resource.js +578 -0
- data/app/assets/javascripts/red_base/dashboard/lib/angular-route.js +880 -0
- data/app/assets/javascripts/red_base/dashboard/lib/angular.js +20031 -0
- data/app/assets/javascripts/red_base/dashboard/lib/lodash.underscore.js +4893 -0
- data/app/assets/javascripts/red_base/dashboard/lib/restangular.js +1066 -0
- data/app/assets/javascripts/red_base/dashboard/locale/translations.js +5 -0
- data/app/assets/javascripts/red_base/dashboard/modules/anim.js +32 -0
- data/app/assets/javascripts/red_base/dashboard/modules/api.js +32 -0
- data/app/assets/javascripts/red_base/dashboard/modules/auth/auth.js +34 -0
- data/app/assets/javascripts/red_base/dashboard/modules/auth/group.js +174 -0
- data/app/assets/javascripts/red_base/dashboard/modules/auth/user.js +122 -0
- data/app/assets/javascripts/red_base/dashboard/modules/list-view.js +293 -0
- data/app/assets/javascripts/red_base/dashboard/modules/logs.js +41 -0
- data/app/assets/javascripts/red_base/dashboard/modules/modules.js +50 -0
- data/app/assets/javascripts/red_base/dashboard/modules/nav.js.erb +92 -0
- data/app/assets/javascripts/red_base/dashboard/templates/application.handlebars.erb +42 -0
- data/app/assets/javascripts/red_base/dashboard/templates/auth/groups/details.handlebars.erb +15 -0
- data/app/assets/javascripts/red_base/dashboard/templates/auth/groups/index.handlebars.erb +7 -0
- data/app/assets/javascripts/red_base/dashboard/templates/auth/groups/new.handlebars.erb +39 -0
- data/app/assets/javascripts/red_base/dashboard/templates/auth/index.handlebars.erb +31 -0
- data/app/assets/javascripts/red_base/dashboard/templates/auth/users/details.handlebars.erb +15 -0
- data/app/assets/javascripts/red_base/dashboard/templates/auth/users/index.handlebars.erb +11 -0
- data/app/assets/javascripts/red_base/dashboard/templates/auth/users/new.handlebars.erb +33 -0
- data/app/assets/javascripts/red_base/dashboard/templates/components/list-view.handlebars.erb +59 -0
- data/app/assets/javascripts/red_base/dashboard/templates/components/model-form.handlebars.erb +3 -0
- data/app/assets/javascripts/red_base/dashboard/templates/modules.handlebars.erb +15 -0
- data/app/assets/javascripts/red_base/dashboard/templates/navigation.handlebars.erb +43 -0
- data/app/assets/javascripts/red_base/dashboard/templates/widgets.handlebars +23 -0
- data/app/assets/javascripts/red_base/dashboard/variables.js.erb +17 -0
- data/app/assets/javascripts/red_base/groups.js +2 -0
- data/app/assets/javascripts/red_base/home.js +2 -0
- data/app/assets/javascripts/red_base/i18n.js +13 -0
- data/app/assets/javascripts/red_base/locale/en.json +27 -0
- data/app/assets/javascripts/red_base/locale/fa.json +27 -0
- data/app/assets/javascripts/red_base/users.js +2 -0
- data/app/assets/stylesheets/red_base/base.css.scss +402 -0
- data/app/assets/stylesheets/red_base/dashboard/dashboard.css.scss +169 -0
- data/app/assets/stylesheets/red_base/dashboard/ltr/application.css +21 -0
- data/app/assets/stylesheets/red_base/dashboard/ltr/base.css.scss.erb +28 -0
- data/app/assets/stylesheets/red_base/dashboard/ltr/base.css.scss~ +15 -0
- data/app/assets/stylesheets/red_base/dashboard/ltr/buttons.css.scss.erb +48 -0
- data/app/assets/stylesheets/red_base/dashboard/ltr/direction.css.scss +38 -0
- data/app/assets/stylesheets/red_base/dashboard/ltr/foundation_and_overrides.css.scss +1014 -0
- data/app/assets/stylesheets/red_base/dashboard/rtl/application.css +21 -0
- data/app/assets/stylesheets/red_base/dashboard/rtl/base.css.scss.erb +31 -0
- data/app/assets/stylesheets/red_base/dashboard/rtl/base.css.scss~ +1 -0
- data/app/assets/stylesheets/red_base/dashboard/rtl/base.css_flymake.scss +25 -0
- data/app/assets/stylesheets/red_base/dashboard/rtl/buttons.css.scss.erb +45 -0
- data/app/assets/stylesheets/red_base/dashboard/rtl/direction.css.scss +37 -0
- data/app/assets/stylesheets/red_base/dashboard/rtl/foundation_and_overrides.css.scss +1014 -0
- data/app/assets/stylesheets/red_base/dashboard/sidebar.css.scss +93 -0
- data/app/assets/stylesheets/red_base/devise.css.scss +34 -0
- data/app/assets/stylesheets/red_base/groups.css +4 -0
- data/app/assets/stylesheets/red_base/home.css.scss +14 -0
- data/app/assets/stylesheets/red_base/ltr/application.css +20 -0
- data/app/assets/stylesheets/red_base/ltr/buttons.css.scss.erb +48 -0
- data/app/assets/stylesheets/red_base/ltr/foundation_and_overrides.scss.erb +1012 -0
- data/app/assets/stylesheets/red_base/mixins.css.scss +15 -0
- data/app/assets/stylesheets/red_base/mixins.css.scss~ +7 -0
- data/app/assets/stylesheets/red_base/rtl/application.css +20 -0
- data/app/assets/stylesheets/red_base/rtl/buttons.css.scss.erb +48 -0
- data/app/assets/stylesheets/red_base/rtl/foundation_and_overrides.scss.erb +1012 -0
- data/app/assets/stylesheets/red_base/users.css +4 -0
- data/app/assets/stylesheets/red_base/variables.css.scss +100 -0
- data/app/controllers/red_base/api/v1/groups_controller.rb +65 -0
- data/app/controllers/red_base/api/v1/logs_controller.rb +12 -0
- data/app/controllers/red_base/api/v1/permissions_controller.rb +17 -0
- data/app/controllers/red_base/api/v1/users_controller.rb +54 -0
- data/app/controllers/red_base/api_controller.rb +51 -0
- data/app/controllers/red_base/application_controller.rb +34 -0
- data/app/controllers/red_base/dashboard_controller.rb +40 -0
- data/app/controllers/red_base/home_controller.rb +19 -0
- data/app/controllers/red_base/omniauth/callbacks_controller.rb +43 -0
- data/app/controllers/red_base/users/omniauth_callbacks_controller.rb~ +2 -0
- data/app/helpers/red_base/application_helper.rb +4 -0
- data/app/helpers/red_base/dashboard_helper.rb +5 -0
- data/app/helpers/red_base/groups_helper.rb +4 -0
- data/app/helpers/red_base/home_helper.rb +4 -0
- data/app/helpers/red_base/users_helper.rb +4 -0
- data/app/models/ability.rb +39 -0
- data/app/models/red_base/group.rb +27 -0
- data/app/models/red_base/permission.rb +15 -0
- data/app/models/red_base/user.rb +77 -0
- data/app/views/angularjs_templates/auth/groups/details.html +21 -0
- data/app/views/angularjs_templates/auth/groups/index.html +5 -0
- data/app/views/angularjs_templates/auth/groups/new.html +40 -0
- data/app/views/angularjs_templates/auth/index.html +30 -0
- data/app/views/angularjs_templates/auth/users/details.html +28 -0
- data/app/views/angularjs_templates/auth/users/index.html +6 -0
- data/app/views/angularjs_templates/auth/users/new.html +45 -0
- data/app/views/angularjs_templates/index.html +8 -0
- data/app/views/angularjs_templates/list-view/index.html +66 -0
- data/app/views/angularjs_templates/locale/fa.po +25 -0
- data/app/views/angularjs_templates/locale/templates.pot +24 -0
- data/app/views/angularjs_templates/logs/index.html +6 -0
- data/app/views/angularjs_templates/modules.html +17 -0
- data/app/views/angularjs_templates/nav.html.erb +38 -0
- data/app/views/angularjs_templates/nav.html.erb~ +43 -0
- data/app/views/devise/confirmations/new.html.erb +34 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +44 -0
- data/app/views/devise/passwords/new.html.erb +32 -0
- data/app/views/devise/registrations/edit.html.erb +29 -0
- data/app/views/devise/registrations/new.html.erb +91 -0
- data/app/views/devise/sessions/new.html.erb +98 -0
- data/app/views/devise/shared/_links.erb +25 -0
- data/app/views/devise/unlocks/new.html.erb +30 -0
- data/app/views/layouts/red_base/application.html.erb +90 -0
- data/app/views/layouts/red_base/dashboard.html.erb +21 -0
- data/app/views/red_base/api/v1/groups/create.json.jbuilder +4 -0
- data/app/views/red_base/api/v1/groups/destroy.html.erb +2 -0
- data/app/views/red_base/api/v1/groups/destroy.json.jbuilder +1 -0
- data/app/views/red_base/api/v1/groups/edit.html.erb +2 -0
- data/app/views/red_base/api/v1/groups/index.html.erb +2 -0
- data/app/views/red_base/api/v1/groups/index.json.jbuilder +6 -0
- data/app/views/red_base/api/v1/groups/new.html.erb +2 -0
- data/app/views/red_base/api/v1/groups/show.html.erb +2 -0
- data/app/views/red_base/api/v1/groups/show.json.jbuilder +5 -0
- data/app/views/red_base/api/v1/groups/update.json.jbuilder +4 -0
- data/app/views/red_base/api/v1/logs/index.json.jbuilder +1 -0
- data/app/views/red_base/api/v1/permissions/index.json.jbuilder +1 -0
- data/app/views/red_base/api/v1/users/create.html.erb +2 -0
- data/app/views/red_base/api/v1/users/create.json.jbuilder +1 -0
- data/app/views/red_base/api/v1/users/destroy.json.jbuilder +1 -0
- data/app/views/red_base/api/v1/users/distroy.html.erb +2 -0
- data/app/views/red_base/api/v1/users/edit.html.erb +2 -0
- data/app/views/red_base/api/v1/users/index.html.erb +2 -0
- data/app/views/red_base/api/v1/users/index.json.jbuilder +4 -0
- data/app/views/red_base/api/v1/users/show.html.erb +2 -0
- data/app/views/red_base/api/v1/users/show.json.jbuilder +2 -0
- data/app/views/red_base/api/v1/users/update.json.jbuilder +1 -0
- data/app/views/red_base/dashboard/index.html.erb +37 -0
- data/app/views/red_base/home/index.html.erb +119 -0
- data/config/initializers/devise.rb +28 -0
- data/config/locales/devise.en.yml +59 -0
- data/config/locales/devise.fa.yml +56 -0
- data/config/locales/fa/LC_MESSAGES/red_base.mo +0 -0
- data/config/locales/fa/messages.mo +0 -0
- data/config/locales/fa/red_base.po +181 -0
- data/config/locales/red_base.pot +181 -0
- data/config/routes.rb +33 -0
- data/db/migrate/20131013091000_devise_create_red_base_users.rb +64 -0
- data/db/migrate/20131020124701_create_red_base_groups.rb +9 -0
- data/db/migrate/20131021170923_create_red_base_permissions.rb +10 -0
- data/db/migrate/20131123120422_add_permissions_groups_table.rb +8 -0
- data/db/seeds.rb +15 -0
- data/lib/devise_patch.rb~ +5 -0
- data/lib/generators/red_base/USAGE +8 -0
- data/lib/generators/red_base/angularjs_resource_generator.rb +74 -0
- data/lib/generators/red_base/install_all_generator.rb +38 -0
- data/lib/generators/red_base/install_generator.rb +42 -0
- data/lib/generators/red_base/install_specs_generator.rb +48 -0
- data/lib/generators/red_base/js_scaffold_generator.rb +232 -0
- data/lib/generators/red_base/templates/README +41 -0
- data/lib/generators/red_base/templates/README~ +4 -0
- data/lib/generators/red_base/templates/SPECS +13 -0
- data/lib/generators/red_base/templates/angularjs/details.html.erb +20 -0
- data/lib/generators/red_base/templates/angularjs/details.html.erb~ +0 -0
- data/lib/generators/red_base/templates/angularjs/index.html.erb +59 -0
- data/lib/generators/red_base/templates/angularjs/module.js.erb +259 -0
- data/lib/generators/red_base/templates/angularjs/new.html.erb +43 -0
- data/lib/generators/red_base/templates/api/controller.rb.erb +54 -0
- data/lib/generators/red_base/templates/api/controller.rb.erb~ +37 -0
- data/lib/generators/red_base/templates/devise.rb +251 -0
- data/lib/generators/red_base/templates/devise.rb~ +238 -0
- data/lib/generators/red_base/templates/fast_gettext.rb +4 -0
- data/lib/generators/red_base/templates/features/api.feature +92 -0
- data/lib/generators/red_base/templates/features/api.step.rb +7 -0
- data/lib/generators/red_base/templates/features/step_definitions/email_steps.rb +206 -0
- data/lib/generators/red_base/templates/features/support/email_spec.rb +1 -0
- data/lib/generators/red_base/templates/features/support/env.rb +79 -0
- data/lib/generators/red_base/templates/formtastic.rb +76 -0
- data/lib/generators/red_base/templates/js_scaffold.README +25 -0
- data/lib/generators/red_base/templates/red_base.rb +14 -0
- data/lib/generators/red_base/templates/red_base.rb~ +251 -0
- data/lib/generators/red_base/templates/seeds.rb +1 -0
- data/lib/generators/red_base/templates/spec/factories/groups.rb +5 -0
- data/lib/generators/red_base/templates/spec/factories/users.rb +10 -0
- data/lib/generators/red_base/templates/spec/spec_helper.rb +69 -0
- data/lib/generators/red_base/templates/spec/support/devise.rb +3 -0
- data/lib/generators/red_base/templates/views/create.json.jbuilder.erb +2 -0
- data/lib/generators/red_base/templates/views/destroy.json.jbuilder.erb +1 -0
- data/lib/generators/red_base/templates/views/index.json.jbuilder.erb +10 -0
- data/lib/generators/red_base/templates/views/index.json.jbuilder.erb~ +0 -0
- data/lib/generators/red_base/templates/views/show.json.jbuilder.erb +6 -0
- data/lib/generators/red_base/templates/views/update.json.jbuilder.erb +6 -0
- data/lib/generators/red_base/views_generator.rb +41 -0
- data/lib/red_base/active_record.rb +78 -0
- data/lib/red_base/active_record.rb~ +0 -0
- data/lib/red_base/api/groups_api.rb +41 -0
- data/lib/red_base/api/permissions_api.rb +24 -0
- data/lib/red_base/api/root.rb +15 -0
- data/lib/red_base/api/users_api.rb +20 -0
- data/lib/red_base/api.rb +61 -0
- data/lib/red_base/cucumber/auth.rb +45 -0
- data/lib/red_base/cucumber/exceptions.rb +40 -0
- data/lib/red_base/cucumber/interaction.rb +43 -0
- data/lib/red_base/cucumber/query.rb +28 -0
- data/lib/red_base/cucumber/urls.rb +76 -0
- data/lib/red_base/cucumber.rb +25 -0
- data/lib/red_base/dashboard/controller.rb +42 -0
- data/lib/red_base/dashboard/module.rb +45 -0
- data/lib/red_base/dashboard/module.rb~ +25 -0
- data/lib/red_base/dashboard.rb +60 -0
- data/lib/red_base/dashboard.rb~ +18 -0
- data/lib/red_base/engine.rb +132 -0
- data/lib/red_base/exceptions.rb +26 -0
- data/lib/red_base/i18n.rb +35 -0
- data/lib/red_base/initialize.rb +7 -0
- data/lib/red_base/omniauth/callbacks.rb +58 -0
- data/lib/red_base/omniauth/callbakcs.rb~ +7 -0
- data/lib/red_base/omniauth.rb +24 -0
- data/lib/red_base/omniauth.rb~ +1 -0
- data/lib/red_base/plugins.rb +44 -0
- data/lib/red_base/version.rb +22 -0
- data/lib/red_base.rb +30 -0
- data/lib/tasks/grunt/Gruntfile.js +25 -0
- data/lib/tasks/red_base_tasks.rake +23 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/spec_helper.rb +52 -0
- metadata +661 -0
@@ -0,0 +1,259 @@
|
|
1
|
+
<% if is_in_engine? %>
|
2
|
+
/* -----------------------------------------------------------------------------
|
3
|
+
Red Base - Basic website skel engine
|
4
|
+
Copyright (C) 2012-2013 Yellowen
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Public License as published by
|
8
|
+
the Free Software Foundation; either version 2 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
This program is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU General Public License along
|
17
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
18
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
19
|
+
----------------------------------------------------------------------------- */
|
20
|
+
|
21
|
+
<% end %>
|
22
|
+
// <%= resource.pluralize %> Module
|
23
|
+
var <%= resource.pluralize %> = angular.module("<%= resource %>", ["ListView", "Anim"]);
|
24
|
+
|
25
|
+
// <%= resource.pluralize %> configuration section ---------------------------
|
26
|
+
<%= resource.pluralize %>.config(["$routeProvider", function($routeProvider){
|
27
|
+
|
28
|
+
// Add any route you need here
|
29
|
+
$routeProvider.
|
30
|
+
when("/<%= resource_url %>", {
|
31
|
+
templateUrl: template("<%= resource_path %>/index"),
|
32
|
+
controller: "<%= resource %>Controller"
|
33
|
+
}).
|
34
|
+
when("/<%= resource_url %>/new",{
|
35
|
+
templateUrl: template("<%= resource_path %>/new"),
|
36
|
+
controller: "Add<%= resource %>Controller"
|
37
|
+
}).
|
38
|
+
when("/<%= resource_url %>/:id/edit",{
|
39
|
+
templateUrl: template("<%= resource_path %>/new"),
|
40
|
+
controller: "Add<%= resource %>Controller"
|
41
|
+
});
|
42
|
+
|
43
|
+
}]);
|
44
|
+
|
45
|
+
// <%= resource %> index controller -------------------------------------------------------
|
46
|
+
// This controller is responsible for list page (index)
|
47
|
+
<%= resource.pluralize %>.controller("<%= resource %>Controller", ["$scope", "gettext", "Restangular",
|
48
|
+
function($scope, gettext, API){
|
49
|
+
|
50
|
+
<% unless options[:no_bulk] %>// Cache object for each field name possible values
|
51
|
+
$scope.cache = {};
|
52
|
+
|
53
|
+
// Change event handler for field_name combobox in bulk edit
|
54
|
+
$scope.field_name_change = function(x){
|
55
|
+
var current_value = $("#field_name").val();
|
56
|
+
$scope.current_field= _.find($scope.fields, function(x){
|
57
|
+
return x.name == current_value;
|
58
|
+
});
|
59
|
+
if( "to" in $scope.current_field ){
|
60
|
+
if (! ($scope.current_field.name in $scope.cache)) {
|
61
|
+
$scope.current_field.to().then(function(x){
|
62
|
+
$scope.cache[$scope.current_field.name] = x;
|
63
|
+
});
|
64
|
+
}
|
65
|
+
}
|
66
|
+
};
|
67
|
+
|
68
|
+
$scope.fields = [<% bulk_edit_fields.each do |name| %>
|
69
|
+
{
|
70
|
+
name: "<%= name %><% if ["belongs_to", "has_many"].include? fields_hash[name] %>_id<% end %>",
|
71
|
+
title: gettext("<%= name.capitalize %>"),
|
72
|
+
type: "<%= fields_hash[name] %>"<% if ["belongs_to", "has_many"].include? fields_hash[name] %>,
|
73
|
+
to: API.all("<%= fields_hash[name].to %>").getList<% end %>
|
74
|
+
},<% end %>
|
75
|
+
];<% end %>
|
76
|
+
|
77
|
+
// details_template is the address of template which should load for
|
78
|
+
// each item details section
|
79
|
+
$scope.details_template = template("<%= resource_path %>/details");
|
80
|
+
|
81
|
+
// Buttons for top of the list-view
|
82
|
+
$scope.buttons = [
|
83
|
+
{
|
84
|
+
title: gettext("New"),
|
85
|
+
icon: "fa fa-plus",
|
86
|
+
classes: "btn tiny green",
|
87
|
+
route: "#<%= resource_url %>/new"
|
88
|
+
|
89
|
+
}<% unless options[:no_bulk] %>,
|
90
|
+
{
|
91
|
+
title: gettext("Bulk Edit"),
|
92
|
+
icon: "fa fa-edit",
|
93
|
+
classes: "btn tiny yellow",
|
94
|
+
action: function(){
|
95
|
+
$scope.$apply("bulk_edit = ! bulk_edit");
|
96
|
+
}
|
97
|
+
}<% end %>
|
98
|
+
];<% unless options[:no_bulk] %>
|
99
|
+
|
100
|
+
/*
|
101
|
+
* On bulk save event
|
102
|
+
*/
|
103
|
+
$scope.bulk_save = function(){
|
104
|
+
|
105
|
+
$scope.view_progressbar = true;
|
106
|
+
var value = $("#field_value").val();
|
107
|
+
var field = $scope.current_field.name;
|
108
|
+
var type = $scope.current_field.type;
|
109
|
+
var field_name = $scope.current_field.title;
|
110
|
+
if ((type == "has_many") || (type == "belongs_to")) {
|
111
|
+
value = parseInt(value, 10);
|
112
|
+
}
|
113
|
+
var requests_count = 0;
|
114
|
+
|
115
|
+
$scope.rfiller = 0;
|
116
|
+
$scope.sfiller = 0;
|
117
|
+
$scope.success = 0;
|
118
|
+
$scope.failed = 0;
|
119
|
+
$scope.total = _.where($scope.<%= resource.pluralize.underscore %>, function(x){return x.is_selected === true;}).length;
|
120
|
+
|
121
|
+
_.each($scope.<%= resource.pluralize.underscore %>, function(x){
|
122
|
+
if( x.is_selected === true ){
|
123
|
+
x[field] = value;
|
124
|
+
requests_count++;
|
125
|
+
|
126
|
+
var rwidth = (requests_count * 100) / $scope.total;
|
127
|
+
if (requests_count == $scope.total) { rwidth = 100; }
|
128
|
+
$scope.rfiller = rwidth + "%";
|
129
|
+
|
130
|
+
API.one("<%= resource.pluralize.underscore %>", x.id).patch(x).then(function(data){
|
131
|
+
$scope.success++;
|
132
|
+
var swidth = parseInt(($scope.success * 100) / $scope.total);
|
133
|
+
if ($scope.sucess == $scope.total) { swidth = 100; }
|
134
|
+
$scope.sfiller = swidth + "%";
|
135
|
+
x[field_name.toLowerCase()] = data[field_name.toLowerCase()];
|
136
|
+
})
|
137
|
+
.catch(function(data){
|
138
|
+
$scope.failed++;
|
139
|
+
catch_error(data);
|
140
|
+
});
|
141
|
+
|
142
|
+
}
|
143
|
+
});
|
144
|
+
|
145
|
+
};
|
146
|
+
|
147
|
+
/*
|
148
|
+
* On bulk cancel event
|
149
|
+
*/
|
150
|
+
$scope.bulk_cancel = function(){
|
151
|
+
$("#field_name").val(0);
|
152
|
+
document.getElementById("bulk_form").reset();
|
153
|
+
$scope.view_progressbar = false;
|
154
|
+
$scope.bulk_edit = false;
|
155
|
+
};
|
156
|
+
<% end %>
|
157
|
+
/*
|
158
|
+
* On delete event handler - `items` is an array of objects to delete
|
159
|
+
*/
|
160
|
+
$scope.on_delete = function(items){
|
161
|
+
|
162
|
+
var query = [];
|
163
|
+
items.forEach(function(item){
|
164
|
+
query.push(item.id);
|
165
|
+
});
|
166
|
+
|
167
|
+
API.all("<%= resource.pluralize.underscore %>").customDELETE(query.join(","))
|
168
|
+
.then(function(data) {
|
169
|
+
|
170
|
+
$scope.<%= resource.pluralize.underscore %> = _.filter($scope.<%= resource.pluralize.underscore %>, function(x){
|
171
|
+
return !(query.indexOf(x.id) != -1);
|
172
|
+
});
|
173
|
+
success_message(data.msg);
|
174
|
+
})
|
175
|
+
.catch(catch_error);
|
176
|
+
};
|
177
|
+
|
178
|
+
API.all("<%= resource.pluralize.underscore %>").getList()
|
179
|
+
.then(function(data){
|
180
|
+
$scope.<%= resource.pluralize.underscore %> = data;
|
181
|
+
})
|
182
|
+
.catch(catch_error);
|
183
|
+
|
184
|
+
}]);
|
185
|
+
|
186
|
+
<%= resource.pluralize %>.controller("Add<%= resource %>Controller", ["Restangular", "$scope", "$location", "$routeParams", "gettext", function(API, $scope, $location, $routeParams, gettext){
|
187
|
+
|
188
|
+
$scope.editing = false;
|
189
|
+
$scope.obj_id = null;
|
190
|
+
<% fields.each do |name, type| %><% if ["belongs_to", "has_many"].include? type %><%= type.get_list %>.then(function(data){
|
191
|
+
$scope.all_<%= type.resource_name %> = data;
|
192
|
+
}).catch(catch_error);<% end %><% end %>
|
193
|
+
|
194
|
+
if( "id" in $routeParams ){
|
195
|
+
$scope.obj_id = $routeParams.id;
|
196
|
+
$scope.editing = true;
|
197
|
+
var obj = API.one("<%= resource.pluralize.underscore %>", $scope.obj_id).get()
|
198
|
+
.then(function(data) {
|
199
|
+
<% fields.each do |field_name, field_type| %>
|
200
|
+
$scope.<%= field_name %> = <% if not ["string", "integer", "belongs_to", "text", "has_many"].include? field_type %><%= "to_#{field_type}(data.#{field_name})" %><% else %>data.<%= field_name %><% end %>;<% end %>
|
201
|
+
})
|
202
|
+
.catch(catch_error);
|
203
|
+
}
|
204
|
+
|
205
|
+
|
206
|
+
$scope.have = function(field, obj_id) {
|
207
|
+
var tmp = _.where($scope[field], {id: obj_id});
|
208
|
+
if (tmp.length > 0) {
|
209
|
+
return true;
|
210
|
+
}
|
211
|
+
else {
|
212
|
+
return false;
|
213
|
+
}
|
214
|
+
};
|
215
|
+
|
216
|
+
$scope.cancel = function(){
|
217
|
+
$(".form input").val("");
|
218
|
+
$location.path("<%= resource_url %>");
|
219
|
+
};
|
220
|
+
|
221
|
+
$scope.save = function(save_another){
|
222
|
+
var <%= resource.underscore %> = {<%= resource.underscore %>: {<% fields.each do |field_name, field_type| %>
|
223
|
+
<% if ["belongs_to"].include? field_type %><%= field_name %>_id: parseInt($scope.<%= field_name %>),<% else %><%= field_name %>: $scope.<%= field_name %>,<% end %>
|
224
|
+
<% end %>
|
225
|
+
}};
|
226
|
+
if ($scope.obj_id) {
|
227
|
+
API.one("<%= resource.pluralize.underscore %>", $scope.obj_id).patch(<%= resource.underscore %>)
|
228
|
+
.then(function(){
|
229
|
+
success_message(gettext("<%= resource %> updated successfully."));
|
230
|
+
if (save_another) {
|
231
|
+
$(".form input").val("");
|
232
|
+
}
|
233
|
+
else {
|
234
|
+
$location.path("<%= resource_url %>");
|
235
|
+
}
|
236
|
+
})
|
237
|
+
.catch(catch_error);
|
238
|
+
}
|
239
|
+
else {
|
240
|
+
console.dir(<%= resource.underscore %>);
|
241
|
+
API.all("<%= resource.pluralize.underscore %>").customPOST(<%= resource.underscore %>, "").then(function(){
|
242
|
+
success_message(gettext("<%= resource %> created successfully."));
|
243
|
+
if (save_another) {
|
244
|
+
$(".form input").val("");
|
245
|
+
}
|
246
|
+
else {
|
247
|
+
$location.path("<%= resource_url %>");
|
248
|
+
}
|
249
|
+
}).catch(catch_error);
|
250
|
+
}
|
251
|
+
|
252
|
+
};
|
253
|
+
}]);
|
254
|
+
<% unless options[:menu].empty? %>
|
255
|
+
<%= resource.pluralize %>.controller("<%= resource %>MenuController", ["gettext", function(gettext){
|
256
|
+
this.menu_items = [<% options[:menu].split(",").each do |menu| %><% title, url = menu.split(":") %>
|
257
|
+
{title: gettext("<%= title %>"), url: "<%= url %>"},<% end %>
|
258
|
+
];
|
259
|
+
}]);<% end %>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<div class="newform">
|
2
|
+
<fieldset class="form">
|
3
|
+
|
4
|
+
<legend ng-if="!editing"><span translate>New <%= resource %></span></legend>
|
5
|
+
<legend ng-if="editing"><span translate>Edit <%= resource %></span></legend>
|
6
|
+
|
7
|
+
<% first = true %>
|
8
|
+
<% fields.each do |field_name, field_type| %>
|
9
|
+
<% if first %><div class="row"><% end %>
|
10
|
+
<div class="small-4 columns <% if not first %>float-left small-offset-2<% end %>">
|
11
|
+
<label translate><%= field_name.to_s.capitalize %> :</label>
|
12
|
+
<% case field_type
|
13
|
+
when "belongs_to" %>
|
14
|
+
<select ng-model="<%= field_name %>" name="<%= field_name %>">
|
15
|
+
<option ng-repeat="item in all_<%= field_type.resource_name %>" value="{{ item.id }}" title="{{ item.name || item }}" ng-selected="item.id === <%= field_name %>.id">{{ item.name || item }}</option>
|
16
|
+
</select>
|
17
|
+
<% when "has_many" %>
|
18
|
+
<select ng-model="<%= field_name %>" name="<%= field_name %>" multiple>
|
19
|
+
<option ng-repeat="item in all_<%= field_type.resource_name %>" value="{{ item.id }}" title="{{ item.name || item }}" ng-selected="have('<%= field_name %>', item.id)">{{ item.name || item }}</option>
|
20
|
+
</select>
|
21
|
+
<% when "text" %>
|
22
|
+
<textarea ng-model="<%= field_name %>"></textarea>
|
23
|
+
<% when "string", nil %>
|
24
|
+
<input ng-model="<%= field_name %>" type="text" class="<%= field_type %>_field" />
|
25
|
+
<% else %>
|
26
|
+
<input ng-model="<%= field_name %>" type="<%= field_type %>" class="<%= field_type %>_field" />
|
27
|
+
<% end %>
|
28
|
+
<small></small>
|
29
|
+
</div>
|
30
|
+
<% if not first %></div><% end %>
|
31
|
+
<% first = !first %>
|
32
|
+
<% end %>
|
33
|
+
</fieldset>
|
34
|
+
|
35
|
+
|
36
|
+
<div class="row">
|
37
|
+
<div class="small-6 columns">
|
38
|
+
<button class="btn small green" ng-click="save(false)"><i class="fa fa-check"></i> <span translate>Save</span></button>
|
39
|
+
<button class="btn small blue" ng-click="save(true)"><i class="fa fa-check"></i> <span translate>Save & Add Another</span></button>
|
40
|
+
<button class="btn small red" ng-click="cancel()"><i class="fa fa-times"></i> <span translate>Cansel</span></button>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
</div>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class API::V1::<%= resource.pluralize %>Controller < RedBase::APIController
|
2
|
+
before_filter :build_resource, :only => :create
|
3
|
+
load_and_authorize_resource :except => [:destory]
|
4
|
+
|
5
|
+
# GET /api/v1/<%= resource.pluralize.underscore %>
|
6
|
+
def index
|
7
|
+
respond_with(@<%= resource.pluralize.underscore %>)
|
8
|
+
end
|
9
|
+
|
10
|
+
def create
|
11
|
+
<% fields.each do |name, type| %><% if type == "has_many" %>
|
12
|
+
<%= name.underscore %> = <%= name.singularize.camelize %>.where({:id => params[:<%= resource.underscore %>][:<%= name %>]})
|
13
|
+
@<%= resource.underscore %>.<%= name.underscore %> = <%= name.underscore %>
|
14
|
+
<% end %><% end %>
|
15
|
+
if @<%= resource.underscore %>.save
|
16
|
+
respond_with(@<%= resource.underscore %>)
|
17
|
+
else
|
18
|
+
respond_with(@<%= resource.underscore %>.errors)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def show
|
23
|
+
respond_with(@<%= resource.underscore %>)
|
24
|
+
end
|
25
|
+
|
26
|
+
def update
|
27
|
+
<% fields.each do |name, type| %><% if type == "has_many" %>
|
28
|
+
<%= name.underscore %> = <%= name.singularize.camelize %>.where({:id => params[:<%= resource.underscore %>][:<%= name %>]})
|
29
|
+
@<%= resource.underscore %>.<%= name.underscore %> = <%= name.underscore %>
|
30
|
+
<% end %><% end %>
|
31
|
+
|
32
|
+
if @<%= resource.underscore %>.update(resource_params)
|
33
|
+
respond_with(@<%= resource.underscore %>)
|
34
|
+
else
|
35
|
+
respond_with(@<%= resource.underscore %>.errors)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def destroy
|
40
|
+
ids = params[:id].split(",")
|
41
|
+
@<%= resource.pluralize.underscore %> = ::<%= resource %>.where(:id => ids)
|
42
|
+
authorize! :destroy, @<%= resource.pluralize.underscore %>
|
43
|
+
@<%= resource.pluralize.underscore %>.destroy_all
|
44
|
+
end
|
45
|
+
|
46
|
+
def build_resource
|
47
|
+
@<%= resource.underscore %> = ::<%= resource %>.new(resource_params)
|
48
|
+
end
|
49
|
+
|
50
|
+
def resource_params
|
51
|
+
params.require(:<%= resource.underscore %>).permit(:id<%= fields_as_params(:relations => true) %>)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_dependency "red_base/api_controller"
|
2
|
+
|
3
|
+
class API::V1::<%= resource.pluralize %>Controller < APIController
|
4
|
+
|
5
|
+
load_and_authorize_resource :except => :destory
|
6
|
+
|
7
|
+
|
8
|
+
# GET /api/v1/<%= resource.pluralize.underscore %>
|
9
|
+
def index
|
10
|
+
end
|
11
|
+
|
12
|
+
def create
|
13
|
+
if @<%= resource.underscore %>.save
|
14
|
+
@<%= resource.underscore %>
|
15
|
+
else
|
16
|
+
@<%= resource.underscore %>.errors
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def show
|
21
|
+
end
|
22
|
+
|
23
|
+
def update
|
24
|
+
if @<%= resource.underscore %>.update
|
25
|
+
@<%= resource.underscore %>
|
26
|
+
else
|
27
|
+
@<%= resource.underscore %>.errors
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def destroy
|
32
|
+
ids = params[:id].split(",")
|
33
|
+
@<% resource.pluralize.underscore %> = <% resource.pluralize %>.where(:id => ids)
|
34
|
+
authorize! :destory, @<% resource.pluralize.underscore %>
|
35
|
+
@@<% resource.pluralize.underscore %>.destroy_all
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,251 @@
|
|
1
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
2
|
+
# Many of these configuration options can be set straight in your model.
|
3
|
+
Devise.setup do |config|
|
4
|
+
# The secret key used by Devise. Devise uses this key to generate
|
5
|
+
# random tokens. Changing this key will render invalid all existing
|
6
|
+
# confirmation, reset password and unlock tokens in the database.
|
7
|
+
config.secret_key = '<%= SecureRandom.hex(64) %>'
|
8
|
+
|
9
|
+
# ==> Mailer Configuration
|
10
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
11
|
+
# note that it will be overwritten if you use your own mailer class
|
12
|
+
# with default "from" parameter.
|
13
|
+
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
14
|
+
|
15
|
+
# Configure the class responsible to send e-mails.
|
16
|
+
# config.mailer = 'Devise::Mailer'
|
17
|
+
|
18
|
+
# ==> ORM configuration
|
19
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
20
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
21
|
+
# available as additional gems.
|
22
|
+
require 'devise/orm/<%= options[:orm] %>'
|
23
|
+
|
24
|
+
# ==> Configuration for any authentication mechanism
|
25
|
+
# Configure which keys are used when authenticating a user. The default is
|
26
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
27
|
+
# authenticating a user, both parameters are required. Remember that those
|
28
|
+
# parameters are used only when authenticating and not when retrieving from
|
29
|
+
# session. If you need permissions, you should implement that in a before filter.
|
30
|
+
# You can also supply a hash where the value is a boolean determining whether
|
31
|
+
# or not authentication should be aborted when the value is not present.
|
32
|
+
# config.authentication_keys = [ :email ]
|
33
|
+
|
34
|
+
# Configure parameters from the request object used for authentication. Each entry
|
35
|
+
# given should be a request method and it will automatically be passed to the
|
36
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
37
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
38
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
39
|
+
# config.request_keys = []
|
40
|
+
|
41
|
+
# Configure which authentication keys should be case-insensitive.
|
42
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
43
|
+
# to authenticate or find a user. Default is :email.
|
44
|
+
config.case_insensitive_keys = [ :email ]
|
45
|
+
|
46
|
+
# Configure which authentication keys should have whitespace stripped.
|
47
|
+
# These keys will have whitespace before and after removed upon creating or
|
48
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
49
|
+
config.strip_whitespace_keys = [ :email ]
|
50
|
+
|
51
|
+
# Tell if authentication through request.params is enabled. True by default.
|
52
|
+
# It can be set to an array that will enable params authentication only for the
|
53
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
54
|
+
# enable it only for database (email + password) authentication.
|
55
|
+
# config.params_authenticatable = true
|
56
|
+
|
57
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
58
|
+
# It can be set to an array that will enable http authentication only for the
|
59
|
+
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
60
|
+
# enable it only for database authentication. The supported strategies are:
|
61
|
+
# :database = Support basic authentication with authentication key + password
|
62
|
+
# config.http_authenticatable = false
|
63
|
+
|
64
|
+
# If http headers should be returned for AJAX requests. True by default.
|
65
|
+
# config.http_authenticatable_on_xhr = true
|
66
|
+
|
67
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
68
|
+
# config.http_authentication_realm = 'Application'
|
69
|
+
|
70
|
+
# It will change confirmation, password recovery and other workflows
|
71
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
72
|
+
# Does not affect registerable.
|
73
|
+
# config.paranoid = true
|
74
|
+
|
75
|
+
# By default Devise will store the user in session. You can skip storage for
|
76
|
+
# particular strategies by setting this option.
|
77
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
78
|
+
# may want to disable generating routes to Devise's sessions controller by
|
79
|
+
# passing :skip => :sessions to `devise_for` in your config/routes.rb
|
80
|
+
config.skip_session_storage = [:http_auth]
|
81
|
+
|
82
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
83
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
84
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
85
|
+
# from the server. You can disable this option at your own risk.
|
86
|
+
# config.clean_up_csrf_token_on_authentication = true
|
87
|
+
|
88
|
+
# ==> Configuration for :database_authenticatable
|
89
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
90
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
91
|
+
#
|
92
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
93
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
94
|
+
# a value less than 10 in other environments.
|
95
|
+
config.stretches = Rails.env.test? ? 1 : 10
|
96
|
+
|
97
|
+
# Setup a pepper to generate the encrypted password.
|
98
|
+
# config.pepper = '<%= SecureRandom.hex(64) %>'
|
99
|
+
|
100
|
+
# ==> Configuration for :confirmable
|
101
|
+
# A period that the user is allowed to access the website even without
|
102
|
+
# confirming his account. For instance, if set to 2.days, the user will be
|
103
|
+
# able to access the website for two days without confirming his account,
|
104
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
105
|
+
# the user cannot access the website without confirming his account.
|
106
|
+
# config.allow_unconfirmed_access_for = 2.days
|
107
|
+
|
108
|
+
# A period that the user is allowed to confirm their account before their
|
109
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
110
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
111
|
+
# their account can't be confirmed with the token any more.
|
112
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
113
|
+
# before confirming their account.
|
114
|
+
# config.confirm_within = 3.days
|
115
|
+
|
116
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
117
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
118
|
+
# db field (see migrations). Until confirmed new email is stored in
|
119
|
+
# unconfirmed email column, and copied to email column on successful confirmation.
|
120
|
+
config.reconfirmable = true
|
121
|
+
|
122
|
+
# Defines which key will be used when confirming an account
|
123
|
+
# config.confirmation_keys = [ :email ]
|
124
|
+
|
125
|
+
# ==> Configuration for :rememberable
|
126
|
+
# The time the user will be remembered without asking for credentials again.
|
127
|
+
# config.remember_for = 2.weeks
|
128
|
+
|
129
|
+
# If true, extends the user's remember period when remembered via cookie.
|
130
|
+
# config.extend_remember_period = false
|
131
|
+
|
132
|
+
# Options to be passed to the created cookie. For instance, you can set
|
133
|
+
# :secure => true in order to force SSL only cookies.
|
134
|
+
# config.rememberable_options = {}
|
135
|
+
|
136
|
+
# ==> Configuration for :validatable
|
137
|
+
# Range for password length. Default is 8..128.
|
138
|
+
config.password_length = 8..128
|
139
|
+
|
140
|
+
# Email regex used to validate email formats. It simply asserts that
|
141
|
+
# one (and only one) @ exists in the given string. This is mainly
|
142
|
+
# to give user feedback and not to assert the e-mail validity.
|
143
|
+
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
144
|
+
|
145
|
+
# ==> Configuration for :timeoutable
|
146
|
+
# The time you want to timeout the user session without activity. After this
|
147
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
148
|
+
# config.timeout_in = 30.minutes
|
149
|
+
|
150
|
+
# If true, expires auth token on session timeout.
|
151
|
+
# config.expire_auth_token_on_timeout = false
|
152
|
+
|
153
|
+
# ==> Configuration for :lockable
|
154
|
+
# Defines which strategy will be used to lock an account.
|
155
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
156
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
157
|
+
# config.lock_strategy = :failed_attempts
|
158
|
+
|
159
|
+
# Defines which key will be used when locking and unlocking an account
|
160
|
+
# config.unlock_keys = [ :email ]
|
161
|
+
|
162
|
+
# Defines which strategy will be used to unlock an account.
|
163
|
+
# :email = Sends an unlock link to the user email
|
164
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
165
|
+
# :both = Enables both strategies
|
166
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
167
|
+
# config.unlock_strategy = :both
|
168
|
+
|
169
|
+
# Number of authentication tries before locking an account if lock_strategy
|
170
|
+
# is failed attempts.
|
171
|
+
# config.maximum_attempts = 20
|
172
|
+
|
173
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
174
|
+
# config.unlock_in = 1.hour
|
175
|
+
|
176
|
+
# ==> Configuration for :recoverable
|
177
|
+
#
|
178
|
+
# Defines which key will be used when recovering the password for an account
|
179
|
+
# config.reset_password_keys = [ :email ]
|
180
|
+
|
181
|
+
# Time interval you can reset your password with a reset password key.
|
182
|
+
# Don't put a too small interval or your users won't have the time to
|
183
|
+
# change their passwords.
|
184
|
+
config.reset_password_within = 6.hours
|
185
|
+
|
186
|
+
# ==> Configuration for :encryptable
|
187
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
188
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
189
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
190
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
191
|
+
# REST_AUTH_SITE_KEY to pepper).
|
192
|
+
#
|
193
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
194
|
+
# config.encryptor = :sha512
|
195
|
+
|
196
|
+
# ==> Scopes configuration
|
197
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
198
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
199
|
+
# are using only default views.
|
200
|
+
# config.scoped_views = false
|
201
|
+
|
202
|
+
# Configure the default scope given to Warden. By default it's the first
|
203
|
+
# devise role declared in your routes (usually :user).
|
204
|
+
# config.default_scope = :user
|
205
|
+
|
206
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
207
|
+
# only the current scope. By default, Devise signs out all scopes.
|
208
|
+
# config.sign_out_all_scopes = true
|
209
|
+
|
210
|
+
# ==> Navigation configuration
|
211
|
+
# Lists the formats that should be treated as navigational. Formats like
|
212
|
+
# :html, should redirect to the sign in page when the user does not have
|
213
|
+
# access, but formats like :xml or :json, should return 401.
|
214
|
+
#
|
215
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
216
|
+
# should add them to the navigational formats lists.
|
217
|
+
#
|
218
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
219
|
+
# config.navigational_formats = ['*/*', :html]
|
220
|
+
|
221
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
222
|
+
config.sign_out_via = :delete
|
223
|
+
|
224
|
+
# ==> OmniAuth
|
225
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
226
|
+
# up on your models and hooks.
|
227
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
228
|
+
|
229
|
+
# ==> Warden configuration
|
230
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
231
|
+
# change the failure app, you can configure them inside the config.warden block.
|
232
|
+
#
|
233
|
+
# config.warden do |manager|
|
234
|
+
# manager.intercept_401 = false
|
235
|
+
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
236
|
+
# end
|
237
|
+
|
238
|
+
# ==> Mountable engine configurations
|
239
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
240
|
+
# is mountable, there are some extra configurations to be taken into account.
|
241
|
+
# The following options are available, assuming the engine is mounted as:
|
242
|
+
#
|
243
|
+
# mount MyEngine, at: '/my_engine'
|
244
|
+
#
|
245
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
246
|
+
# config.router_name = :my_engine
|
247
|
+
#
|
248
|
+
# When using omniauth, Devise cannot automatically set Omniauth path,
|
249
|
+
# so you need to do it manually. For the users scope, it would be:
|
250
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
251
|
+
end
|