odania 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{LICENSE.txt → MIT-LICENSE} +1 -3
- data/README.md +3 -3
- data/Rakefile +33 -3
- data/app/assets/config/odania_manifest.js +0 -0
- data/app/assets/javascripts/application.js +13 -0
- data/app/assets/javascripts/textAngular.js +15 -0
- data/app/assets/javascripts/textAngular/textAngular-rangy.min.js +478 -0
- data/app/assets/javascripts/textAngular/textAngular-sanitize.min.js +322 -0
- data/app/assets/javascripts/textAngular/textAngular.min.js +1481 -0
- data/app/assets/stylesheets/scaffold.css +80 -0
- data/app/assets/stylesheets/textAngular/application.css +15 -0
- data/app/assets/stylesheets/textAngular/textAngular.css +204 -0
- data/app/controllers/admin/home_controller.rb +2 -0
- data/app/controllers/admin/languages_controller.rb +74 -0
- data/app/controllers/admin_controller.rb +4 -0
- data/app/controllers/application_controller.rb +3 -0
- data/app/controllers/categories_controller.rb +34 -0
- data/app/controllers/home_controller.rb +11 -0
- data/app/controllers/protected/home_controller.rb +2 -0
- data/app/controllers/protected_controller.rb +22 -0
- data/app/controllers/registration_controller.rb +12 -0
- data/app/helpers/standard_form_builder.rb +71 -0
- data/app/helpers/standard_form_helper.rb +13 -0
- data/app/models/admin.rb +37 -0
- data/app/models/language.rb +5 -0
- data/app/models/user.rb +47 -0
- data/app/views/admin/home/index.html.erb +1 -0
- data/app/views/admin/languages/_form.html.erb +16 -0
- data/app/views/admin/languages/_language.json.jbuilder +2 -0
- data/app/views/admin/languages/edit.html.erb +6 -0
- data/app/views/admin/languages/index.html.erb +27 -0
- data/app/views/admin/languages/index.json.jbuilder +1 -0
- data/app/views/admin/languages/new.html.erb +5 -0
- data/app/views/admin/languages/show.html.erb +9 -0
- data/app/views/admin/languages/show.json.jbuilder +1 -0
- data/app/views/categories/index.html.erb +9 -0
- data/app/views/categories/show.html.erb +16 -0
- data/app/views/devise/confirmations/new.html.erb +11 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/email_changed.html.erb +7 -0
- data/app/views/devise/mailer/password_change.html.erb +4 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +9 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +8 -0
- data/app/views/devise/passwords/edit.html.erb +13 -0
- data/app/views/devise/passwords/new.html.erb +11 -0
- data/app/views/devise/registrations/edit.html.erb +39 -0
- data/app/views/devise/registrations/new.html.erb +15 -0
- data/app/views/devise/sessions/new.html.erb +14 -0
- data/app/views/devise/shared/_links.html.erb +25 -0
- data/app/views/devise/unlocks/new.html.erb +11 -0
- data/app/views/home/index.html.erb +11 -0
- data/app/views/languages/_form.html.erb +20 -0
- data/app/views/languages/edit.html.erb +6 -0
- data/app/views/languages/index.html.erb +27 -0
- data/app/views/languages/new.html.erb +5 -0
- data/app/views/languages/show.html.erb +9 -0
- data/app/views/protected/home/index.html.erb +1 -0
- data/config/initializers/elasticsearch.rb +5 -0
- data/config/locales/devise.en.yml +64 -0
- data/config/routes.rb +23 -0
- data/db/seeds.rb +5 -0
- data/lib/odania.rb +7 -56
- data/lib/odania/engine.rb +14 -0
- data/lib/odania/version.rb +1 -1
- data/lib/tasks/odania_tasks.rake +4 -0
- data/lib/templates/erb/scaffold/_form.html.erb +27 -0
- data/lib/templates/erb/scaffold/edit.html.erb +6 -0
- data/lib/templates/erb/scaffold/index.html.erb +31 -0
- data/lib/templates/erb/scaffold/new.html.erb +5 -0
- data/lib/templates/erb/scaffold/show.html.erb +11 -0
- metadata +129 -84
- data/.codeclimate.yml +0 -30
- data/.gitignore +0 -17
- data/.rspec +0 -2
- data/.rubocop.yml +0 -1156
- data/.travis.yml +0 -20
- data/Gemfile +0 -4
- data/Gemfile.lock +0 -113
- data/Guardfile +0 -31
- data/features/plugin.feature +0 -35
- data/features/step_definitions/plugin_steps.rb +0 -75
- data/features/support/env.rb +0 -1
- data/lib/odania/config.rb +0 -17
- data/lib/odania/config/backend.rb +0 -31
- data/lib/odania/config/backend_group.rb +0 -43
- data/lib/odania/config/domain.rb +0 -59
- data/lib/odania/config/duplicates.rb +0 -28
- data/lib/odania/config/global_config.rb +0 -210
- data/lib/odania/config/layout.rb +0 -30
- data/lib/odania/config/page.rb +0 -29
- data/lib/odania/config/page_base.rb +0 -47
- data/lib/odania/config/plugin_config.rb +0 -58
- data/lib/odania/config/style.rb +0 -36
- data/lib/odania/config/sub_domain.rb +0 -113
- data/lib/odania/config/subdomain_config.rb +0 -124
- data/lib/odania/consul.rb +0 -138
- data/lib/odania/plugin.rb +0 -103
- data/odania.gemspec +0 -34
- data/spec/fixtures/global_config.json +0 -135
- data/spec/fixtures/plugin_config_1.json +0 -102
- data/spec/lib/odania/config/global_config_spec.rb +0 -69
- data/spec/lib/odania/config/plugin_config_spec.rb +0 -31
- data/spec/lib/odania/plugin_spec.rb +0 -25
- data/spec/lib/odania_spec.rb +0 -10
- data/spec/spec_helper.rb +0 -19
- data/spec/support/consul_mock.rb +0 -123
- data/tasks/odania.rake +0 -8
- data/tasks/rspec.rake +0 -7
@@ -0,0 +1,80 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #fff;
|
3
|
+
color: #333;
|
4
|
+
margin: 33px;
|
5
|
+
}
|
6
|
+
|
7
|
+
body, p, ol, ul, td {
|
8
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
9
|
+
font-size: 13px;
|
10
|
+
line-height: 18px;
|
11
|
+
}
|
12
|
+
|
13
|
+
pre {
|
14
|
+
background-color: #eee;
|
15
|
+
padding: 10px;
|
16
|
+
font-size: 11px;
|
17
|
+
}
|
18
|
+
|
19
|
+
a {
|
20
|
+
color: #000;
|
21
|
+
}
|
22
|
+
|
23
|
+
a:visited {
|
24
|
+
color: #666;
|
25
|
+
}
|
26
|
+
|
27
|
+
a:hover {
|
28
|
+
color: #fff;
|
29
|
+
background-color: #000;
|
30
|
+
}
|
31
|
+
|
32
|
+
th {
|
33
|
+
padding-bottom: 5px;
|
34
|
+
}
|
35
|
+
|
36
|
+
td {
|
37
|
+
padding: 0 5px 7px;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.field,
|
41
|
+
div.actions {
|
42
|
+
margin-bottom: 10px;
|
43
|
+
}
|
44
|
+
|
45
|
+
#notice {
|
46
|
+
color: green;
|
47
|
+
}
|
48
|
+
|
49
|
+
.field_with_errors {
|
50
|
+
padding: 2px;
|
51
|
+
background-color: red;
|
52
|
+
display: table;
|
53
|
+
}
|
54
|
+
|
55
|
+
#error_explanation {
|
56
|
+
width: 450px;
|
57
|
+
border: 2px solid red;
|
58
|
+
padding: 7px 7px 0;
|
59
|
+
margin-bottom: 20px;
|
60
|
+
background-color: #f0f0f0;
|
61
|
+
}
|
62
|
+
|
63
|
+
#error_explanation h2 {
|
64
|
+
text-align: left;
|
65
|
+
font-weight: bold;
|
66
|
+
padding: 5px 5px 5px 15px;
|
67
|
+
font-size: 12px;
|
68
|
+
margin: -7px -7px 0;
|
69
|
+
background-color: #c00;
|
70
|
+
color: #fff;
|
71
|
+
}
|
72
|
+
|
73
|
+
#error_explanation ul li {
|
74
|
+
font-size: 12px;
|
75
|
+
list-style: square;
|
76
|
+
}
|
77
|
+
|
78
|
+
label {
|
79
|
+
display: block;
|
80
|
+
}
|
@@ -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_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,204 @@
|
|
1
|
+
.ta-hidden-input {
|
2
|
+
width: 1px;
|
3
|
+
height: 1px;
|
4
|
+
border: none;
|
5
|
+
margin: 0;
|
6
|
+
padding: 0;
|
7
|
+
position: absolute;
|
8
|
+
top: -10000px;
|
9
|
+
left: -10000px;
|
10
|
+
opacity: 0;
|
11
|
+
overflow: hidden;
|
12
|
+
}
|
13
|
+
|
14
|
+
/* add generic styling for the editor */
|
15
|
+
.ta-root.focussed > .ta-scroll-window.form-control {
|
16
|
+
border-color: #66afe9;
|
17
|
+
outline: 0;
|
18
|
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
19
|
+
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
20
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
21
|
+
}
|
22
|
+
|
23
|
+
.ta-editor.ta-html, .ta-scroll-window.form-control {
|
24
|
+
min-height: 300px;
|
25
|
+
height: auto;
|
26
|
+
overflow: auto;
|
27
|
+
font-family: inherit;
|
28
|
+
font-size: 100%;
|
29
|
+
}
|
30
|
+
|
31
|
+
.ta-scroll-window.form-control {
|
32
|
+
position: relative;
|
33
|
+
padding: 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
.ta-scroll-window > .ta-bind {
|
37
|
+
height: auto;
|
38
|
+
min-height: 300px;
|
39
|
+
padding: 6px 12px;
|
40
|
+
}
|
41
|
+
|
42
|
+
.ta-editor:focus {
|
43
|
+
user-select: text;
|
44
|
+
}
|
45
|
+
|
46
|
+
/* add the styling for the awesomness of the resizer */
|
47
|
+
.ta-resizer-handle-overlay {
|
48
|
+
z-index: 100;
|
49
|
+
position: absolute;
|
50
|
+
display: none;
|
51
|
+
}
|
52
|
+
|
53
|
+
.ta-resizer-handle-overlay > .ta-resizer-handle-info {
|
54
|
+
position: absolute;
|
55
|
+
bottom: 16px;
|
56
|
+
right: 16px;
|
57
|
+
border: 1px solid black;
|
58
|
+
background-color: #FFF;
|
59
|
+
padding: 0 4px;
|
60
|
+
opacity: 0.7;
|
61
|
+
}
|
62
|
+
|
63
|
+
.ta-resizer-handle-overlay > .ta-resizer-handle-background {
|
64
|
+
position: absolute;
|
65
|
+
bottom: 5px;
|
66
|
+
right: 5px;
|
67
|
+
left: 5px;
|
68
|
+
top: 5px;
|
69
|
+
border: 1px solid black;
|
70
|
+
background-color: rgba(0, 0, 0, 0.2);
|
71
|
+
}
|
72
|
+
|
73
|
+
.ta-resizer-handle-overlay > .ta-resizer-handle-corner {
|
74
|
+
width: 10px;
|
75
|
+
height: 10px;
|
76
|
+
position: absolute;
|
77
|
+
}
|
78
|
+
|
79
|
+
.ta-resizer-handle-overlay > .ta-resizer-handle-corner-tl {
|
80
|
+
top: 0;
|
81
|
+
left: 0;
|
82
|
+
border-left: 1px solid black;
|
83
|
+
border-top: 1px solid black;
|
84
|
+
}
|
85
|
+
|
86
|
+
.ta-resizer-handle-overlay > .ta-resizer-handle-corner-tr {
|
87
|
+
top: 0;
|
88
|
+
right: 0;
|
89
|
+
border-right: 1px solid black;
|
90
|
+
border-top: 1px solid black;
|
91
|
+
}
|
92
|
+
|
93
|
+
.ta-resizer-handle-overlay > .ta-resizer-handle-corner-bl {
|
94
|
+
bottom: 0;
|
95
|
+
left: 0;
|
96
|
+
border-left: 1px solid black;
|
97
|
+
border-bottom: 1px solid black;
|
98
|
+
}
|
99
|
+
|
100
|
+
.ta-resizer-handle-overlay > .ta-resizer-handle-corner-br {
|
101
|
+
bottom: 0;
|
102
|
+
right: 0;
|
103
|
+
border: 1px solid black;
|
104
|
+
cursor: se-resize;
|
105
|
+
background-color: white;
|
106
|
+
}
|
107
|
+
|
108
|
+
/* copy the popover code from bootstrap so this will work even without it */
|
109
|
+
.popover {
|
110
|
+
position: absolute;
|
111
|
+
top: 0;
|
112
|
+
left: 0;
|
113
|
+
z-index: 1060;
|
114
|
+
display: none;
|
115
|
+
max-width: 276px;
|
116
|
+
padding: 1px;
|
117
|
+
font-size: 14px;
|
118
|
+
font-weight: normal;
|
119
|
+
line-height: 1.42857143;
|
120
|
+
text-align: left;
|
121
|
+
white-space: normal;
|
122
|
+
background-color: #fff;
|
123
|
+
-webkit-background-clip: padding-box;
|
124
|
+
background-clip: padding-box;
|
125
|
+
border: 1px solid #ccc;
|
126
|
+
border: 1px solid rgba(0, 0, 0, .2);
|
127
|
+
border-radius: 6px;
|
128
|
+
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
|
129
|
+
box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
|
130
|
+
}
|
131
|
+
|
132
|
+
.popover.top {
|
133
|
+
margin-top: -10px;
|
134
|
+
}
|
135
|
+
|
136
|
+
.popover.bottom {
|
137
|
+
margin-top: 10px;
|
138
|
+
}
|
139
|
+
|
140
|
+
.popover-title {
|
141
|
+
padding: 8px 14px;
|
142
|
+
margin: 0;
|
143
|
+
font-size: 14px;
|
144
|
+
background-color: #f7f7f7;
|
145
|
+
border-bottom: 1px solid #ebebeb;
|
146
|
+
border-radius: 5px 5px 0 0;
|
147
|
+
}
|
148
|
+
|
149
|
+
.popover-content {
|
150
|
+
padding: 9px 14px;
|
151
|
+
}
|
152
|
+
|
153
|
+
.popover > .arrow,
|
154
|
+
.popover > .arrow:after {
|
155
|
+
position: absolute;
|
156
|
+
display: block;
|
157
|
+
width: 0;
|
158
|
+
height: 0;
|
159
|
+
border-color: transparent;
|
160
|
+
border-style: solid;
|
161
|
+
}
|
162
|
+
|
163
|
+
.popover > .arrow {
|
164
|
+
border-width: 11px;
|
165
|
+
}
|
166
|
+
|
167
|
+
.popover > .arrow:after {
|
168
|
+
content: "";
|
169
|
+
border-width: 10px;
|
170
|
+
}
|
171
|
+
|
172
|
+
.popover.top > .arrow {
|
173
|
+
bottom: -11px;
|
174
|
+
left: 50%;
|
175
|
+
margin-left: -11px;
|
176
|
+
border-top-color: #999;
|
177
|
+
border-top-color: rgba(0, 0, 0, .25);
|
178
|
+
border-bottom-width: 0;
|
179
|
+
}
|
180
|
+
|
181
|
+
.popover.top > .arrow:after {
|
182
|
+
bottom: 1px;
|
183
|
+
margin-left: -10px;
|
184
|
+
content: " ";
|
185
|
+
border-top-color: #fff;
|
186
|
+
border-bottom-width: 0;
|
187
|
+
}
|
188
|
+
|
189
|
+
.popover.bottom > .arrow {
|
190
|
+
top: -11px;
|
191
|
+
left: 50%;
|
192
|
+
margin-left: -11px;
|
193
|
+
border-top-width: 0;
|
194
|
+
border-bottom-color: #999;
|
195
|
+
border-bottom-color: rgba(0, 0, 0, .25);
|
196
|
+
}
|
197
|
+
|
198
|
+
.popover.bottom > .arrow:after {
|
199
|
+
top: 1px;
|
200
|
+
margin-left: -10px;
|
201
|
+
content: " ";
|
202
|
+
border-top-width: 0;
|
203
|
+
border-bottom-color: #fff;
|
204
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
class Admin::LanguagesController < AdminController
|
2
|
+
before_action :set_language, only: [:show, :edit, :update, :destroy]
|
3
|
+
|
4
|
+
# GET /languages
|
5
|
+
# GET /languages.json
|
6
|
+
def index
|
7
|
+
@languages = Language.all
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /languages/1
|
11
|
+
# GET /languages/1.json
|
12
|
+
def show
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /languages/new
|
16
|
+
def new
|
17
|
+
@language = Language.new
|
18
|
+
end
|
19
|
+
|
20
|
+
# GET /languages/1/edit
|
21
|
+
def edit
|
22
|
+
end
|
23
|
+
|
24
|
+
# POST /languages
|
25
|
+
# POST /languages.json
|
26
|
+
def create
|
27
|
+
@language = Language.new(language_params)
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
if @language.save
|
31
|
+
format.html {redirect_to @language, notice: 'Language was successfully created.'}
|
32
|
+
format.json {render :show, status: :created, location: @language}
|
33
|
+
else
|
34
|
+
format.html {render :new}
|
35
|
+
format.json {render json: @language.errors, status: :unprocessable_entity}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# PATCH/PUT /languages/1
|
41
|
+
# PATCH/PUT /languages/1.json
|
42
|
+
def update
|
43
|
+
respond_to do |format|
|
44
|
+
if @language.update(language_params)
|
45
|
+
format.html {redirect_to @language, notice: 'Language was successfully updated.'}
|
46
|
+
format.json {render :show, status: :ok, location: @language}
|
47
|
+
else
|
48
|
+
format.html {render :edit}
|
49
|
+
format.json {render json: @language.errors, status: :unprocessable_entity}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# DELETE /languages/1
|
55
|
+
# DELETE /languages/1.json
|
56
|
+
def destroy
|
57
|
+
@language.destroy
|
58
|
+
respond_to do |format|
|
59
|
+
format.html {redirect_to languages_url, notice: 'Language was successfully destroyed.'}
|
60
|
+
format.json {head :no_content}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
# Use callbacks to share common setup or constraints between actions.
|
66
|
+
def set_language
|
67
|
+
@language = Language.find(params[:id])
|
68
|
+
end
|
69
|
+
|
70
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
71
|
+
def language_params
|
72
|
+
params.require(:language).permit(:name)
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class CategoriesController < ApplicationController
|
2
|
+
def index
|
3
|
+
@categories = $elasticsearch.search index: 'categories', type: 'category', body: {
|
4
|
+
query: {
|
5
|
+
bool: {
|
6
|
+
must: [
|
7
|
+
{match: {domain: @domain}},
|
8
|
+
{match: {subdomain: @subdomain}},
|
9
|
+
{regexp: {category: "#{@req_url}.*"}}
|
10
|
+
]
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
@hits = @categories['hits']['hits']
|
16
|
+
end
|
17
|
+
|
18
|
+
def show
|
19
|
+
@category = params[:id]
|
20
|
+
@pages = $elasticsearch.search index: 'contents', type: 'content', body: {
|
21
|
+
query: {
|
22
|
+
bool: {
|
23
|
+
must: [
|
24
|
+
{match: {domain: @domain}},
|
25
|
+
{match: {subdomain: @subdomain}},
|
26
|
+
{regexp: {category: "#{@category}.*"}}
|
27
|
+
]
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
@hits = @pages['hits']['hits']
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class ProtectedController < ApplicationController
|
2
|
+
before_action :authenticate_user!
|
3
|
+
after_action :add_flash_to_header
|
4
|
+
layout 'protected'
|
5
|
+
|
6
|
+
skip_before_action :verify_authenticity_token
|
7
|
+
|
8
|
+
def add_flash_to_header
|
9
|
+
# add different flashes to header
|
10
|
+
response.headers['X-Flash-Error'] = flash[:error] unless flash[:error].blank?
|
11
|
+
response.headers['X-Flash-Warning'] = flash[:warning] unless flash[:warning].blank?
|
12
|
+
response.headers['X-Flash-Notice'] = flash[:notice] unless flash[:notice].blank?
|
13
|
+
response.headers['X-Flash-Message'] = flash[:message] unless flash[:message].blank?
|
14
|
+
|
15
|
+
# make sure flash does not appear on the next page
|
16
|
+
flash.discard
|
17
|
+
end
|
18
|
+
|
19
|
+
def bad_api_request(msg)
|
20
|
+
render json: {message: msg}, status: :bad_request
|
21
|
+
end
|
22
|
+
end
|