geri 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +26 -0
- data/app/assets/javascripts/geri/admin.js +33 -0
- data/app/assets/javascripts/geri/admin/app.js +758 -0
- data/app/assets/javascripts/geri/admin/editor.js +56 -0
- data/app/assets/javascripts/geri/admin/password_resets.js +2 -0
- data/app/assets/stylesheets/geri/admin.css.less +60 -0
- data/app/assets/stylesheets/geri/admin/app.css +4915 -0
- data/app/assets/stylesheets/geri/admin/ckeditor/contents.css +135 -0
- data/app/assets/stylesheets/geri/admin/editor.css.less +38 -0
- data/app/assets/stylesheets/geri/admin/password_resets.css +4 -0
- data/app/assets/stylesheets/geri/admin/skin-blue.less +142 -0
- data/app/assets/vendor/ckeditor/CHANGES.md +1065 -0
- data/app/assets/vendor/ckeditor/LICENSE.md +1420 -0
- data/app/assets/vendor/ckeditor/README.md +39 -0
- data/app/assets/vendor/ckeditor/adapters/jquery.js +10 -0
- data/app/assets/vendor/ckeditor/build-config.js +69 -0
- data/app/assets/vendor/ckeditor/ckeditor.js +775 -0
- data/app/assets/vendor/ckeditor/config.js +34 -0
- data/app/assets/vendor/ckeditor/contents.css +135 -0
- data/app/assets/vendor/ckeditor/lang/en.js +5 -0
- data/app/assets/vendor/ckeditor/plugins/about/dialogs/about.js +7 -0
- data/app/assets/vendor/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png +0 -0
- data/app/assets/vendor/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
- data/app/assets/vendor/ckeditor/plugins/clipboard/dialogs/paste.js +12 -0
- data/app/assets/vendor/ckeditor/plugins/dialog/dialogDefinition.js +4 -0
- data/app/assets/vendor/ckeditor/plugins/icons.png +0 -0
- data/app/assets/vendor/ckeditor/plugins/icons_hidpi.png +0 -0
- data/app/assets/vendor/ckeditor/plugins/link/dialogs/anchor.js +7 -0
- data/app/assets/vendor/ckeditor/plugins/link/dialogs/link.js +26 -0
- data/app/assets/vendor/ckeditor/plugins/link/images/anchor.png +0 -0
- data/app/assets/vendor/ckeditor/plugins/link/images/hidpi/anchor.png +0 -0
- data/app/assets/vendor/ckeditor/samples/css/samples.css +1640 -0
- data/app/assets/vendor/ckeditor/samples/img/github-top.png +0 -0
- data/app/assets/vendor/ckeditor/samples/img/header-bg.png +0 -0
- data/app/assets/vendor/ckeditor/samples/img/header-separator.png +0 -0
- data/app/assets/vendor/ckeditor/samples/img/logo.png +0 -0
- data/app/assets/vendor/ckeditor/samples/img/navigation-tip.png +0 -0
- data/app/assets/vendor/ckeditor/samples/index.html +128 -0
- data/app/assets/vendor/ckeditor/samples/js/sample.js +53 -0
- data/app/assets/vendor/ckeditor/samples/js/sf.js +17 -0
- data/app/assets/vendor/ckeditor/samples/old/ajax.html +85 -0
- data/app/assets/vendor/ckeditor/samples/old/api.html +210 -0
- data/app/assets/vendor/ckeditor/samples/old/appendto.html +59 -0
- data/app/assets/vendor/ckeditor/samples/old/assets/inlineall/logo.png +0 -0
- data/app/assets/vendor/ckeditor/samples/old/assets/outputxhtml/outputxhtml.css +204 -0
- data/app/assets/vendor/ckeditor/samples/old/assets/posteddata.php +59 -0
- data/app/assets/vendor/ckeditor/samples/old/assets/sample.jpg +0 -0
- data/app/assets/vendor/ckeditor/samples/old/assets/uilanguages/languages.js +7 -0
- data/app/assets/vendor/ckeditor/samples/old/datafiltering.html +508 -0
- data/app/assets/vendor/ckeditor/samples/old/dialog/assets/my_dialog.js +48 -0
- data/app/assets/vendor/ckeditor/samples/old/dialog/dialog.html +190 -0
- data/app/assets/vendor/ckeditor/samples/old/divreplace.html +144 -0
- data/app/assets/vendor/ckeditor/samples/old/enterkey/enterkey.html +106 -0
- data/app/assets/vendor/ckeditor/samples/old/index.html +122 -0
- data/app/assets/vendor/ckeditor/samples/old/inlineall.html +314 -0
- data/app/assets/vendor/ckeditor/samples/old/inlinebycode.html +124 -0
- data/app/assets/vendor/ckeditor/samples/old/inlinetextarea.html +113 -0
- data/app/assets/vendor/ckeditor/samples/old/jquery.html +103 -0
- data/app/assets/vendor/ckeditor/samples/old/readonly.html +76 -0
- data/app/assets/vendor/ckeditor/samples/old/replacebyclass.html +60 -0
- data/app/assets/vendor/ckeditor/samples/old/replacebycode.html +59 -0
- data/app/assets/vendor/ckeditor/samples/old/sample.css +357 -0
- data/app/assets/vendor/ckeditor/samples/old/sample.js +50 -0
- data/app/assets/vendor/ckeditor/samples/old/sample_posteddata.php +16 -0
- data/app/assets/vendor/ckeditor/samples/old/tabindex.html +78 -0
- data/app/assets/vendor/ckeditor/samples/old/toolbar/toolbar.html +235 -0
- data/app/assets/vendor/ckeditor/samples/old/uicolor.html +72 -0
- data/app/assets/vendor/ckeditor/samples/old/uilanguages.html +122 -0
- data/app/assets/vendor/ckeditor/samples/old/wysiwygarea/fullpage.html +80 -0
- data/app/assets/vendor/ckeditor/samples/old/xhtmlstyle.html +234 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/css/fontello.css +55 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/font/LICENSE.txt +10 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/font/config.json +28 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/font/fontello.eot +0 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/font/fontello.svg +14 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/font/fontello.ttf +0 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/font/fontello.woff +0 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/index.html +446 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/js/abstracttoolbarmodifier.js +13 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/js/fulltoolbareditor.js +9 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/js/toolbarmodifier.js +33 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/js/toolbartextmodifier.js +14 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/LICENSE +19 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css +325 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.js +288 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/javascript.js +25 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/neo.css +36 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.css +38 -0
- data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.js +16 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/dialog.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/dialog_ie.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/dialog_ie7.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/dialog_ie8.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/dialog_iequirks.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/dialog_opera.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/editor.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/editor_gecko.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/editor_ie.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/editor_ie7.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/editor_ie8.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/editor_iequirks.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/icons.png +0 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/icons_hidpi.png +0 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/images/arrow.png +0 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/images/close.png +0 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/images/hidpi/close.png +0 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/images/hidpi/lock-open.png +0 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/images/hidpi/lock.png +0 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/images/hidpi/refresh.png +0 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/images/lock-open.png +0 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/images/lock.png +0 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/images/refresh.png +0 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/readme.md +35 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/sample/bootstrapck-sample.html +127 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/sample/css/bootstrapck-sample.css +1 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/sample/js/analytics.js +4 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/sample/js/jquery-1.11.0.min.js +189 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/gecko/editor_gecko.scss +25 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/ie/dialog_ie.scss +62 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/ie/editor_ie.scss +71 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/ie7/dialog_ie7.scss +68 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/ie7/editor_ie7.scss +213 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/ie8/dialog_ie8.scss +24 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/ie8/editor_ie8.scss +27 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/iequirks/dialog_iequirks.scss +21 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/iequirks/editor_iequirks.scss +79 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/opera/dialog_opera.scss +31 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_colorpanel.scss +119 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_elementspath.scss +66 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_mainui.scss +189 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_menu.scss +182 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_panel.scss +199 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_presets.scss +32 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_reset.scss +107 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_richcombo.scss +174 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_toolbar.scss +317 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/editor.scss +66 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/config/_colors.scss +61 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/config/_config.scss +9 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/config/_defaults.scss +37 -0
- data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/dialog/dialog.scss +822 -0
- data/app/assets/vendor/ckeditor/styles.js +111 -0
- data/app/controllers/geri/admin/admin_users_controller.rb +56 -0
- data/app/controllers/geri/admin/dashboard_controller.rb +8 -0
- data/app/controllers/geri/admin/editor_controller.rb +33 -0
- data/app/controllers/geri/admin/password_resets_controller.rb +21 -0
- data/app/controllers/geri/admin/sessions_controller.rb +24 -0
- data/app/controllers/geri/admin_controller.rb +19 -0
- data/app/controllers/geri/application_controller.rb +5 -0
- data/app/controllers/geri/pages_controller.rb +34 -0
- data/app/helpers/geri/admin/dashboard_helper.rb +4 -0
- data/app/helpers/geri/admin/editor_helper.rb +4 -0
- data/app/helpers/geri/admin/pages_helper.rb +45 -0
- data/app/helpers/geri/admin/partials_helper.rb +4 -0
- data/app/helpers/geri/admin/password_resets_helper.rb +4 -0
- data/app/helpers/geri/admin/sessions_helper.rb +4 -0
- data/app/helpers/geri/admin_helper.rb +24 -0
- data/app/helpers/geri/admin_users_helper.rb +4 -0
- data/app/helpers/geri/application_helper.rb +26 -0
- data/app/helpers/geri/meta_helper.rb +32 -0
- data/app/mailers/application_mailer.rb +4 -0
- data/app/mailers/geri/admin_user_mailer.rb +11 -0
- data/app/models/geri/admin_user.rb +14 -0
- data/app/models/geri/content.rb +6 -0
- data/app/models/geri/password_reset.rb +17 -0
- data/app/models/geri/session.rb +20 -0
- data/app/views/geri/admin/admin_users/_form.html.erb +5 -0
- data/app/views/geri/admin/admin_users/edit.html.erb +27 -0
- data/app/views/geri/admin/admin_users/index.html.erb +45 -0
- data/app/views/geri/admin/admin_users/new.html.erb +17 -0
- data/app/views/geri/admin/dashboard/index.html.erb +1 -0
- data/app/views/geri/admin/editor/template.html.erb +17 -0
- data/app/views/geri/admin/password_resets/new.html.erb +17 -0
- data/app/views/geri/admin/sessions/new.html.erb +23 -0
- data/app/views/geri/admin/shared/_aside.html.erb +16 -0
- data/app/views/geri/admin/shared/_header.html.erb +31 -0
- data/app/views/geri/admin/shared/_menu_item.html.erb +17 -0
- data/app/views/geri/admin_user_mailer/reset_password_email.text.erb +7 -0
- data/app/views/layouts/geri/admin.html.erb +24 -0
- data/app/views/layouts/geri/admin/sessions.html.erb +21 -0
- data/app/views/layouts/mailer.html.erb +5 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/config/initializers/geri.rb +7 -0
- data/config/initializers/sorcery.rb +463 -0
- data/config/locales/devise.en.yml +62 -0
- data/config/locales/en.yml +13 -0
- data/config/routes.rb +23 -0
- data/db/migrate/20160409151523_create_geri_contents.rb +8 -0
- data/db/migrate/20160411205412_sorcery_core.rb +20 -0
- data/lib/generators/geri/install/USAGE +8 -0
- data/lib/generators/geri/install/install_generator.rb +54 -0
- data/lib/generators/geri/install/templates/bower.json +8 -0
- data/lib/generators/geri/install/templates/index.html.erb +46 -0
- data/lib/generators/geri/install/templates/initializer.rb +12 -0
- data/lib/generators/geri/install/templates/layout.html.erb +11 -0
- data/lib/generators/geri/install/templates/site.css.less +1 -0
- data/lib/generators/geri/install/templates/site.js +1 -0
- data/lib/geri.rb +7 -0
- data/lib/geri/cli.rb +6 -0
- data/lib/geri/cli/base.rb +23 -0
- data/lib/geri/cli/extension.rb +18 -0
- data/lib/geri/config.rb +29 -0
- data/lib/geri/config/menu_item.rb +35 -0
- data/lib/geri/engine.rb +34 -0
- data/lib/geri/tasks.rb +3 -0
- data/lib/geri/tasks/create_admin_user.rb +40 -0
- data/lib/geri/version.rb +3 -0
- data/lib/tasks/geri_tasks.rake +15 -0
- metadata +449 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
4
|
+
*/
|
5
|
+
|
6
|
+
// This file contains style definitions that can be used by CKEditor plugins.
|
7
|
+
//
|
8
|
+
// The most common use for it is the "stylescombo" plugin, which shows a combo
|
9
|
+
// in the editor toolbar, containing all styles. Other plugins instead, like
|
10
|
+
// the div plugin, use a subset of the styles on their feature.
|
11
|
+
//
|
12
|
+
// If you don't have plugins that depend on this file, you can simply ignore it.
|
13
|
+
// Otherwise it is strongly recommended to customize this file to match your
|
14
|
+
// website requirements and design properly.
|
15
|
+
|
16
|
+
CKEDITOR.stylesSet.add( 'default', [
|
17
|
+
/* Block Styles */
|
18
|
+
|
19
|
+
// These styles are already available in the "Format" combo ("format" plugin),
|
20
|
+
// so they are not needed here by default. You may enable them to avoid
|
21
|
+
// placing the "Format" combo in the toolbar, maintaining the same features.
|
22
|
+
/*
|
23
|
+
{ name: 'Paragraph', element: 'p' },
|
24
|
+
{ name: 'Heading 1', element: 'h1' },
|
25
|
+
{ name: 'Heading 2', element: 'h2' },
|
26
|
+
{ name: 'Heading 3', element: 'h3' },
|
27
|
+
{ name: 'Heading 4', element: 'h4' },
|
28
|
+
{ name: 'Heading 5', element: 'h5' },
|
29
|
+
{ name: 'Heading 6', element: 'h6' },
|
30
|
+
{ name: 'Preformatted Text',element: 'pre' },
|
31
|
+
{ name: 'Address', element: 'address' },
|
32
|
+
*/
|
33
|
+
|
34
|
+
{ name: 'Italic Title', element: 'h2', styles: { 'font-style': 'italic' } },
|
35
|
+
{ name: 'Subtitle', element: 'h3', styles: { 'color': '#aaa', 'font-style': 'italic' } },
|
36
|
+
{
|
37
|
+
name: 'Special Container',
|
38
|
+
element: 'div',
|
39
|
+
styles: {
|
40
|
+
padding: '5px 10px',
|
41
|
+
background: '#eee',
|
42
|
+
border: '1px solid #ccc'
|
43
|
+
}
|
44
|
+
},
|
45
|
+
|
46
|
+
/* Inline Styles */
|
47
|
+
|
48
|
+
// These are core styles available as toolbar buttons. You may opt enabling
|
49
|
+
// some of them in the Styles combo, removing them from the toolbar.
|
50
|
+
// (This requires the "stylescombo" plugin)
|
51
|
+
/*
|
52
|
+
{ name: 'Strong', element: 'strong', overrides: 'b' },
|
53
|
+
{ name: 'Emphasis', element: 'em' , overrides: 'i' },
|
54
|
+
{ name: 'Underline', element: 'u' },
|
55
|
+
{ name: 'Strikethrough', element: 'strike' },
|
56
|
+
{ name: 'Subscript', element: 'sub' },
|
57
|
+
{ name: 'Superscript', element: 'sup' },
|
58
|
+
*/
|
59
|
+
|
60
|
+
{ name: 'Marker', element: 'span', attributes: { 'class': 'marker' } },
|
61
|
+
|
62
|
+
{ name: 'Big', element: 'big' },
|
63
|
+
{ name: 'Small', element: 'small' },
|
64
|
+
{ name: 'Typewriter', element: 'tt' },
|
65
|
+
|
66
|
+
{ name: 'Computer Code', element: 'code' },
|
67
|
+
{ name: 'Keyboard Phrase', element: 'kbd' },
|
68
|
+
{ name: 'Sample Text', element: 'samp' },
|
69
|
+
{ name: 'Variable', element: 'var' },
|
70
|
+
|
71
|
+
{ name: 'Deleted Text', element: 'del' },
|
72
|
+
{ name: 'Inserted Text', element: 'ins' },
|
73
|
+
|
74
|
+
{ name: 'Cited Work', element: 'cite' },
|
75
|
+
{ name: 'Inline Quotation', element: 'q' },
|
76
|
+
|
77
|
+
{ name: 'Language: RTL', element: 'span', attributes: { 'dir': 'rtl' } },
|
78
|
+
{ name: 'Language: LTR', element: 'span', attributes: { 'dir': 'ltr' } },
|
79
|
+
|
80
|
+
/* Object Styles */
|
81
|
+
|
82
|
+
{
|
83
|
+
name: 'Styled image (left)',
|
84
|
+
element: 'img',
|
85
|
+
attributes: { 'class': 'left' }
|
86
|
+
},
|
87
|
+
|
88
|
+
{
|
89
|
+
name: 'Styled image (right)',
|
90
|
+
element: 'img',
|
91
|
+
attributes: { 'class': 'right' }
|
92
|
+
},
|
93
|
+
|
94
|
+
{
|
95
|
+
name: 'Compact table',
|
96
|
+
element: 'table',
|
97
|
+
attributes: {
|
98
|
+
cellpadding: '5',
|
99
|
+
cellspacing: '0',
|
100
|
+
border: '1',
|
101
|
+
bordercolor: '#ccc'
|
102
|
+
},
|
103
|
+
styles: {
|
104
|
+
'border-collapse': 'collapse'
|
105
|
+
}
|
106
|
+
},
|
107
|
+
|
108
|
+
{ name: 'Borderless Table', element: 'table', styles: { 'border-style': 'hidden', 'background-color': '#E6E6FA' } },
|
109
|
+
{ name: 'Square Bulleted List', element: 'ul', styles: { 'list-style-type': 'square' } }
|
110
|
+
] );
|
111
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Geri
|
2
|
+
module Admin
|
3
|
+
class AdminUsersController < AdminController
|
4
|
+
|
5
|
+
def index
|
6
|
+
@admin_users = AdminUser.all
|
7
|
+
end
|
8
|
+
|
9
|
+
def new
|
10
|
+
@admin_user = AdminUser.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def edit
|
14
|
+
@admin_user = AdminUser.find(params[:id])
|
15
|
+
end
|
16
|
+
|
17
|
+
def update
|
18
|
+
@admin_user = AdminUser.find(params[:id])
|
19
|
+
if @admin_user
|
20
|
+
.update_attributes(current_user == @admin_user ? admin_user_params_with_password : admin_user_params)
|
21
|
+
flash[:success] = 'The Admin User was successfully updated.'
|
22
|
+
return redirect_to edit_admin_admin_user_path(@admin_user)
|
23
|
+
end
|
24
|
+
render :edit
|
25
|
+
end
|
26
|
+
|
27
|
+
def create
|
28
|
+
@admin_user = AdminUser.new(admin_user_params)
|
29
|
+
if @admin_user.save
|
30
|
+
flash[:success] = 'The Admin User was sucessfully created, an email confirmation has been sent with ' +
|
31
|
+
'instructions for setting their password!'
|
32
|
+
return redirect_to admin_admin_users_path
|
33
|
+
end
|
34
|
+
render :new
|
35
|
+
end
|
36
|
+
|
37
|
+
def destroy
|
38
|
+
@admin_user = AdminUser.find(params[:id])
|
39
|
+
@admin_user.delete
|
40
|
+
flash[:success] = 'The Admin User was successfully deleted.'
|
41
|
+
redirect_to admin_admin_users_path
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def admin_user_params
|
47
|
+
params.require(:admin_user).permit(:email, :first_name, :last_name)
|
48
|
+
end
|
49
|
+
|
50
|
+
def admin_user_params_with_password
|
51
|
+
params.require(:admin_user).permit(:email, :first_name, :last_name, :password, :password_confirmation)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_dependency "geri/application_controller"
|
2
|
+
|
3
|
+
module Geri
|
4
|
+
class Admin::EditorController < ApplicationController
|
5
|
+
include Geri::Admin::PagesHelper
|
6
|
+
skip_before_action :verify_authenticity_token, only: [:update_contents]
|
7
|
+
|
8
|
+
|
9
|
+
def index
|
10
|
+
redirect_to '/'
|
11
|
+
end
|
12
|
+
|
13
|
+
def template
|
14
|
+
render 'template', layout: false
|
15
|
+
end
|
16
|
+
|
17
|
+
def update_contents
|
18
|
+
content_params.each do |name, content|
|
19
|
+
Content.find_or_initialize_by(name: name).tap do |c|
|
20
|
+
c.body = geri_sanitize(content)
|
21
|
+
end.save!
|
22
|
+
end
|
23
|
+
render json: {sucess: true}
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def content_params
|
29
|
+
params.require(:contents)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_dependency "geri/application_controller"
|
2
|
+
|
3
|
+
module Geri
|
4
|
+
class Admin::PasswordResetsController < AdminController
|
5
|
+
layout 'geri/admin/sessions'
|
6
|
+
|
7
|
+
def new
|
8
|
+
@password_reset = PasswordReset.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def create
|
12
|
+
@admin_user = AdminUser.find_by(email: params[:password_reset][:email])
|
13
|
+
if @admin_user
|
14
|
+
@admin_user.deliver_reset_password_instructions!
|
15
|
+
end
|
16
|
+
flash[:success] = 'If your account was found an email has been sent with instructions to reset your password.'
|
17
|
+
redirect_to new_admin_password_reset_url
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Geri
|
2
|
+
class Admin::SessionsController < AdminController
|
3
|
+
skip_before_filter :require_login
|
4
|
+
|
5
|
+
def new
|
6
|
+
@session = Session.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def create
|
10
|
+
@session = Session.new(params[:session])
|
11
|
+
unless login(@session.email, @session.password)
|
12
|
+
flash[:danger] = t('admin.sessions.login_required', default: 'The email/password combination was invalid')
|
13
|
+
return render :new
|
14
|
+
end
|
15
|
+
redirect_to admin_root_url
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy
|
19
|
+
logout
|
20
|
+
redirect_to root_url
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_dependency 'geri/application_controller'
|
2
|
+
|
3
|
+
module Geri
|
4
|
+
class AdminController < ApplicationController
|
5
|
+
before_filter :require_login
|
6
|
+
before_filter :set_menu_items
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def not_authenticated
|
11
|
+
redirect_to admin_login_url
|
12
|
+
end
|
13
|
+
|
14
|
+
def set_menu_items
|
15
|
+
@menu_items = Geri::Config.menu_items
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Geri
|
2
|
+
class PagesController < ApplicationController
|
3
|
+
before_action :set_view_path
|
4
|
+
|
5
|
+
def show
|
6
|
+
render render_options_for_path(params[:path])
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def render_options_for_path(path)
|
12
|
+
return { file: 'index.html.erb', layout: 'layout.html.erb' } unless path
|
13
|
+
if File.exists?(page_root.join("#{path.underscore}.html.erb"))
|
14
|
+
{ file: path.underscore, layout: 'layout.html.erb' }
|
15
|
+
else
|
16
|
+
{ file: "#{path.underscore}/index", layout: 'layout.html.erb' }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def _normalize_layout(name)
|
21
|
+
name
|
22
|
+
end
|
23
|
+
|
24
|
+
def page_root
|
25
|
+
Rails.root.join('app', 'site')
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_view_path
|
29
|
+
prepend_view_path(page_root.to_s)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Geri
|
2
|
+
module Admin::PagesHelper
|
3
|
+
|
4
|
+
def geri_sanitize(content)
|
5
|
+
ActionController::Base.helpers.sanitize(content, {
|
6
|
+
tags: %w{ p div strong ol ul li em},
|
7
|
+
attributes: %w{ href target }
|
8
|
+
})
|
9
|
+
end
|
10
|
+
|
11
|
+
def editable(name, &block)
|
12
|
+
name = "#{current_page}_#{name}"
|
13
|
+
content = Content.find_by(name: name) && geri_sanitize(Content.find_by(name: name).body)
|
14
|
+
content ||= capture(&block)
|
15
|
+
if current_user
|
16
|
+
content = capture do
|
17
|
+
content_tag(:div, contenteditable: true, id: name, class: 'editable') { content }
|
18
|
+
end
|
19
|
+
unless @ckeditor_loaded
|
20
|
+
content << javascript_tag('window.CKEDITOR_BASEPATH = "assets/ckeditor/"')
|
21
|
+
content << javascript_include_tag('ckeditor/ckeditor')
|
22
|
+
content << javascript_tag('CKEDITOR.disableAutoInline = true')
|
23
|
+
@ckeditor_loaded = true
|
24
|
+
end
|
25
|
+
unless @editor_loaded
|
26
|
+
content << stylesheet_link_tag('geri/admin/editor')
|
27
|
+
content << javascript_include_tag('geri/admin/editor')
|
28
|
+
end
|
29
|
+
content << javascript_tag do
|
30
|
+
%Q{
|
31
|
+
CKEDITOR.inline('#{name}', {
|
32
|
+
on: {
|
33
|
+
change: function(event) {
|
34
|
+
GERI_EDITOR.update(event.editor.name)
|
35
|
+
}
|
36
|
+
}
|
37
|
+
})
|
38
|
+
}.html_safe
|
39
|
+
end
|
40
|
+
end
|
41
|
+
content
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Geri
|
2
|
+
module AdminHelper
|
3
|
+
|
4
|
+
def current_path?(path)
|
5
|
+
url_for(overwrite_params: nil) == path
|
6
|
+
end
|
7
|
+
|
8
|
+
def sidebar_link(name, path, icon=nil)
|
9
|
+
html_options= {}
|
10
|
+
html_options[:class] = 'active' if current_path?(path)
|
11
|
+
content_tag(:li, html_options) do
|
12
|
+
content = ''
|
13
|
+
if icon
|
14
|
+
content << content_tag(:i, '', class: "fa fa-#{icon}")
|
15
|
+
end
|
16
|
+
content = link_to(path) do
|
17
|
+
content.html_safe + content_tag(:span, name)
|
18
|
+
end
|
19
|
+
content
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Geri
|
2
|
+
module ApplicationHelper
|
3
|
+
|
4
|
+
def flash_alert
|
5
|
+
type = flash_type
|
6
|
+
if type
|
7
|
+
content_tag(:div, flash[type], class: "alert alert-#{type}")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def current_page
|
12
|
+
'index' unless params[:path]
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def flash_type
|
18
|
+
return :warning if flash[:warning]
|
19
|
+
return :success if flash[:success]
|
20
|
+
return :danger if flash[:danger]
|
21
|
+
return :info if flash[:info]
|
22
|
+
false
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|