roroacms 0.0.6.7 → 0.0.6.8

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.
@@ -91,5 +91,5 @@ $(document).ready(function() {
91
91
  $("#tableFilter").keyup(function() {
92
92
  dTable.fnFilter($(this).val());
93
93
  });
94
- $('.tooltipState:not(.active)').tooltip({delay: {show:1000, hide:100}});
94
+ $('.tooltipState').tooltip({delay: {show:500, hide:100}});
95
95
  });
@@ -44,4 +44,5 @@ $(document).ready(function(){
44
44
 
45
45
  }
46
46
 
47
- });
47
+ });
48
+
@@ -3525,6 +3525,16 @@ input, textarea, select, input[type=submit] {
3525
3525
  -webkit-appearance: none;
3526
3526
  }
3527
3527
 
3528
+ .modal-content {
3529
+ border: 1px solid #ffffff;
3530
+ box-shadow: none;
3531
+ }
3532
+
3533
+ small.mic-info {
3534
+ display: block;
3535
+ padding:10px 0px;
3536
+ }
3537
+
3528
3538
 
3529
3539
  @media only screen and (max-width: 767px) and (min-width: 480px) {
3530
3540
  #main-content .h1 {
@@ -124,12 +124,12 @@ module Roroacms
124
124
  end
125
125
 
126
126
 
127
- # Delete the admin, one thing to remember is you are not allowed to destory the super user.
128
- # You are only allowed to destroy yourself unless you are the super user.
127
+ # Delete the admin, one thing to remember is you are not allowed to destory the overlord.
128
+ # You are only allowed to destroy yourself unless you are the overlord.
129
129
 
130
130
  def destroy
131
131
  @admin = Admin.find(params[:id])
132
- @admin.destroy
132
+ @admin.destroy if @admin.overlord == 'N'
133
133
 
134
134
  respond_to do |format|
135
135
  format.html { redirect_to admin_administrators_path, notice: I18n.t("controllers.admin.administrators.destroy.flash.success") }
@@ -65,7 +65,7 @@ module Roroacms
65
65
  # saves the menu on the fly via ajax. This usually gets called if there is any change to the menu object
66
66
 
67
67
  def save_menu
68
- if MenuOption.save_menu_on_fly params
68
+ if MenuOption.save_menu_on_fly(params)
69
69
  render :inline => 'done'
70
70
  end
71
71
  end
@@ -42,6 +42,7 @@ module Roroacms
42
42
 
43
43
  end
44
44
 
45
+ # creates a user group via an ajax call and returns the HTML for that user group
45
46
 
46
47
  def create_user_group
47
48
  @key = params[:key]
@@ -52,7 +52,7 @@ module Roroacms
52
52
 
53
53
  def current_user
54
54
  if !session["warden.user.admin.key"].blank?
55
- @current_admin ||= Admin.find(session["warden.user.admin.key"][0][0])
55
+ @current_admin ||= Admin.find_by_id(session["warden.user.admin.key"][0][0])
56
56
  else
57
57
  nil
58
58
  end
@@ -137,7 +137,7 @@ module Roroacms
137
137
  redirect_to :back, flash: { error: I18n.t('generic.demo_notification') } and return
138
138
  end
139
139
 
140
- render :inline => 'demo' and return if params[:action] == 'save_menu'
140
+ render :inline => 'demo' and return if params[:action] == 'save_menu' && !current_user.blank? && current_user.username.downcase == 'demo' && Setting.get('demonstration_mode') == 'Y'
141
141
 
142
142
  end
143
143
 
@@ -201,36 +201,7 @@ module Roroacms
201
201
  # +dir+:: the directory that you want to list the controllers for
202
202
 
203
203
  def list_controllers(dir = 'admin')
204
- hash = {}
205
- controllers = list_controllers_raw(dir)
206
-
207
- controllers.each do |f|
208
-
209
- key = f.sub("#{Roroacms::Engine.root}/app/controllers/roroacms/admin/", '')
210
- value = key.sub('_controller.rb', '')
211
-
212
- next if value == 'dashboard'
213
-
214
- v =
215
- case value
216
- when 'settings/general'
217
- 'Settings'
218
- when 'terms'
219
- 'Categories & Tags'
220
- when 'posts'
221
- 'Articles'
222
- when 'administrators'
223
- 'Users'
224
- else
225
- value
226
- end
227
-
228
- hash[ucwords(v)] = key.sub('_controller.rb', '')
229
-
230
- end
231
-
232
- hash.sort
233
-
204
+ Setting.list_controllers(dir)
234
205
  end
235
206
 
236
207
  # get user group data and return the value for the given key
@@ -73,18 +73,6 @@ module Roroacms
73
73
  change ? hash : nil
74
74
  end
75
75
 
76
- # list controllers in given directory
77
- # Params:
78
- # +dir+:: directory that you want to list all of the controllers from
79
-
80
- def list_controllers_raw(dir = "")
81
- dir = dir + "/**/" if !dir.blank?
82
- controller_list = Array.new
83
- Dir["#{Roroacms::Engine.root}/app/controllers**/roroacms/#{dir}*.rb"].each do |file|
84
- controller_list.push(file.split('/').last.sub!("_controller.rb",""))
85
- end
86
- end
87
-
88
76
  # capitalizes all words in a string
89
77
  # Params:
90
78
  # +str+:: the string
@@ -114,15 +102,8 @@ module Roroacms
114
102
 
115
103
  def strip_url(url)
116
104
 
117
- return url if url.blank?
118
-
119
- url.sub!(/www./, '') if url.include? "www."
105
+ Setting.strip_url(url)
120
106
 
121
- url.sub!(/https\:\/\//, '') if url.include? "https://"
122
-
123
- url.sub!(/http\:\/\//, '') if url.include? "http://"
124
-
125
- return url
126
107
  end
127
108
 
128
109
  # reutrns a nested menu
@@ -146,7 +146,7 @@ module Roroacms
146
146
  if !current_user.blank? && !params[:admin_preview].blank? && params[:admin_preview] == 'true'
147
147
  @content = Post.where("post_type = 'page' AND post_visible = 'Y' AND (post_status = 'Published' OR post_status = 'Draft')").find_by_structured_url("/#{url}")
148
148
  else
149
- @content = Post.where(status, :post_type => 'page', :post_status => 'Published', :post_visible => 'Y').find_by_structured_url("/#{url}")
149
+ @content = Post.where(status + " AND post_type = 'page' AND post_visible = 'Y'").find_by_structured_url("/#{url}")
150
150
  end
151
151
 
152
152
  # add a breadcrumb for each of its parents by running through each segment
@@ -242,7 +242,7 @@ module Roroacms
242
242
  if !current_user.blank? && !params[:admin_preview].blank? && params[:admin_preview] == 'true'
243
243
  @content = Post.where("post_type = 'post' AND post_visible = 'Y' AND (post_status = 'Published' OR post_status = 'Draft')").find_by_post_slug(segments[1])
244
244
  else
245
- @content = Post.where(status, :post_type => 'post', :disabled => 'N', :post_visible => 'Y').find_by_post_slug(segments[1])
245
+ @content = Post.where(status + " AND post_type = 'post' AND post_visible = 'Y'").find_by_post_slug(segments[1])
246
246
  end
247
247
 
248
248
  render_404 and return if @content.nil?
@@ -10,6 +10,8 @@ module Roroacms
10
10
 
11
11
  def get_meta_headers
12
12
 
13
+ headtags = ''
14
+
13
15
  # decide wether it is a page or it is a template displying other content i.e. the category page
14
16
 
15
17
  if !@content.nil?
@@ -25,11 +27,13 @@ module Roroacms
25
27
  headtags = get_manual_metadata 'home'
26
28
  else
27
29
  # use the page content to generate the meta data
28
- headtags = "#{get_page_title}\n"
29
- headtags += "#{get_meta_description}\n"
30
- headtags += "#{get_google_analytics}\n"
31
- headtags += "#{get_robots_tag}"
32
- headtags += "#{canonical_urls}"
30
+ if @content.post_seo_is_disabled != 'Y'
31
+ headtags = "#{get_page_title}\n"
32
+ headtags += "#{get_meta_description}\n"
33
+ headtags += "#{get_google_analytics}\n"
34
+ headtags += "#{get_robots_tag}"
35
+ headtags += "#{canonical_urls}"
36
+ end
33
37
  end
34
38
 
35
39
  render :inline => headtags
@@ -8,8 +8,7 @@ module Roroacms
8
8
  def site_url(str = nil)
9
9
  url = Setting.get('site_url')
10
10
  str = str[1..-1] if !str.blank? && str[0,1] == '/'
11
- url = url + '/' if !url.blank? && url[-1, 1] != '/'
12
- "#{Setting.get('url_prefix')}#{strip_url(url)}#{str}"
11
+ "#{Setting.get('url_prefix')}#{strip_url(url)}/#{str}"
13
12
  end
14
13
 
15
14
  # GENERIC Functions #
@@ -73,7 +73,6 @@ module Roroacms
73
73
 
74
74
  def deal_with_abnormalaties
75
75
  self.overlord = 'N'
76
- self.avatar = site_url('assets/roroacms/default-profile.jpg')
77
76
  end
78
77
 
79
78
  # checks if the cover image is blank and sets the cover image to blank if this is the case
@@ -1,6 +1,9 @@
1
1
  module Roroacms
2
2
  class Setting < ActiveRecord::Base
3
3
 
4
+ include GeneralHelper
5
+ include AdminRoroaHelper
6
+
4
7
  after_save :after_reload_settings
5
8
 
6
9
  # get a certain settings value
@@ -9,8 +12,8 @@ module Roroacms
9
12
 
10
13
  def self.get(setting_name)
11
14
  @reference ||= filter_settings
15
+ ret = @reference[setting_name]
12
16
  ret = @reference[setting_name].gsub("\\", '') if setting_name == 'user_groups'
13
- ret = @reference[setting_name]
14
17
  ret
15
18
  end
16
19
 
@@ -67,8 +70,10 @@ module Roroacms
67
70
  # +params+:: the parameters
68
71
 
69
72
  def self.save_data(params)
73
+
70
74
  params.each do |key, value|
71
- value = ActiveSupport::JSON.encode(value) if key == 'user_groups'
75
+ value = ActiveSupport::JSON.encode(user_group_check(value)) if key == 'user_groups'
76
+ value = Setting.strip_url(value) if key == 'site_url'
72
77
  value = value.gsub(/[^0-9]/i, '') if key == 'pagination_per_fe'
73
78
  set = Setting.where("setting_name = ?", key).update_all('setting' => value)
74
79
  end
@@ -77,6 +82,16 @@ module Roroacms
77
82
 
78
83
  end
79
84
 
85
+ def self.user_group_check(hash)
86
+ h = []
87
+ Setting.list_controllers.each do |k,v|
88
+ h << v
89
+ end
90
+ hash['admin'] = h
91
+ hash.keys.sort
92
+ return hash
93
+ end
94
+
80
95
 
81
96
  # reload the settings instance variable - this is used on the settings update function
82
97
 
@@ -88,6 +103,66 @@ module Roroacms
88
103
  @reference = Setting.filter_settings
89
104
  end
90
105
 
106
+ def self.list_controllers(dir = 'admin')
107
+ hash = {}
108
+ controllers = Setting.list_controllers_raw(dir)
109
+
110
+ controllers.each do |f|
111
+
112
+ key = f.sub("#{Roroacms::Engine.root}/app/controllers/roroacms/admin/", '')
113
+ value = key.sub('_controller.rb', '')
114
+
115
+ next if value == 'dashboard'
116
+
117
+ v =
118
+ case value
119
+ when 'settings/general'
120
+ 'Settings'
121
+ when 'terms'
122
+ 'Categories & Tags'
123
+ when 'posts'
124
+ 'Articles'
125
+ when 'administrators'
126
+ 'Users'
127
+ else
128
+ value
129
+ end
130
+ v = v.split(' ').select {|w| w.capitalize! || w }.join(' ')
131
+ hash[v] = key.sub('_controller.rb', '')
132
+
133
+ end
134
+
135
+ hash.sort
136
+ end
137
+
138
+
139
+ # list controllers in given directory
140
+ # Params:
141
+ # +dir+:: directory that you want to list all of the controllers from
142
+
143
+ def self.list_controllers_raw(dir = "")
144
+ dir = dir + "/**/" if !dir.blank?
145
+ controller_list = Array.new
146
+ Dir["#{Roroacms::Engine.root}/app/controllers**/roroacms/#{dir}*.rb"].each do |file|
147
+ controller_list.push(file.split('/').last.sub!("_controller.rb",""))
148
+ end
149
+ end
150
+
151
+
152
+ def self.strip_url(url)
153
+ return url if url.blank?
154
+
155
+ url.sub!(/www./, '') if url.include? "www."
156
+
157
+ url.sub!(/https\:\/\//, '') if url.include? "https://"
158
+
159
+ url.sub!(/http\:\/\//, '') if url.include? "http://"
160
+
161
+ url = url[0...-1] if url[-1, 1] == '/'
162
+
163
+ return url
164
+ end
165
+
91
166
 
92
167
  # build and return a hash of the SMTP settings via the settings in the admin panel.
93
168
  # this stops you having to change the settings in the config file and having to reload the application.
@@ -3,14 +3,14 @@
3
3
  <div class="panel-body">
4
4
  <div class="tab-wrapper tab-left ">
5
5
  <ul class="nav nav-tabs">
6
- <li class="active">
6
+ <li class="active tooltipState" data-toggle="tooltip" data-placement="right" data-title="<%= t("generic.profile") %>">
7
7
  <a href="#general" data-toggle="tab">
8
8
  <i class="fa fa-user"></i>
9
9
  </a>
10
10
  </li>
11
11
  </ul>
12
12
  <div class="tab-content">
13
- <%= render :partial => 'roroacms/admin/partials/submit_bar' %>
13
+ <%= render :partial => 'roroacms/admin/partials/submit_bar', :locals => { admin_record: @admin } %>
14
14
  <div class="tab-pane active" id="general">
15
15
 
16
16
  <% if !@admin.id.blank? %>
@@ -18,7 +18,11 @@
18
18
  <div class="well well-background" style="background-image: url('<%= @admin.cover_picture %>');">
19
19
  <center>
20
20
  <div class="imr-wrapper">
21
- <img src="<%= @admin.avatar %>" name="aboutme" width="140" height="140" class="img-circle">
21
+ <% if @admin.avatar.blank? %>
22
+ <%= image_tag("roroacms/default-profile.jpg", size: "140", class: "img-circle") %>
23
+ <% else %>
24
+ <img src="<%= @admin.avatar %>" name="aboutme" width="140" height="140" class="img-circle">
25
+ <% end %>
22
26
  <span></span>
23
27
  </div>
24
28
  <h3><%= @admin.username %></h3>
@@ -86,8 +90,7 @@
86
90
  <div class="clearfix"></div>
87
91
  </div>
88
92
 
89
-
90
- <% if is_overlord? || @admin.id == nil %>
93
+ <% if (is_overlord? || @admin.id == nil) && @admin.id != current_user.id %>
91
94
 
92
95
  <div class="form-group">
93
96
  <%= f.label :access_level, :class => "col-sm-3 control-label" %>
@@ -23,7 +23,11 @@
23
23
  <% @admins.each do |admin| %>
24
24
  <tr class="<%= cycle('list_line_odd', 'list_line_even') %>">
25
25
  <td>
26
- <img src="<%= admin.avatar %>" class="img-circle hidden-xs" width="35" height="35">&nbsp;
26
+ <% if admin.avatar.blank? %>
27
+ <%= image_tag 'roroacms/default-profile.jpg', height: '35', width: '35', class: "img-circle hidden-xs" %>
28
+ <% else %>
29
+ <img src="<%= admin.avatar %>" class="img-circle hidden-xs" width="35" height="35">&nbsp;
30
+ <% end %>
27
31
  </td>
28
32
  <td>
29
33
  <%= admin.username %>
@@ -35,8 +39,10 @@
35
39
  <%= link_to edit_admin_administrator_path(admin), :class => 'btn btn-default btn-xs' do %>
36
40
  <i class="fa fa-pencil"></i>
37
41
  <% end %>
38
- <%= link_to admin_administrator_path(admin), method: :delete, data: { confirm: t("views.admin.generic.confirm") }, :class => 'btn btn-danger btn-xs' do %>
39
- <i class="fa fa-trash-o"></i>
42
+ <% if admin.overlord != 'Y' %>
43
+ <%= link_to admin_administrator_path(admin), method: :delete, data: { confirm: t("views.admin.generic.confirm") }, :class => 'btn btn-danger btn-xs' do %>
44
+ <i class="fa fa-trash-o"></i>
45
+ <% end %>
40
46
  <% end %>
41
47
  </div>
42
48
  <% end %>
@@ -1,9 +1,13 @@
1
1
  <%= form_for [:admin, @comment] do |f| %>
2
- <div class="panel panel-default">
2
+ <div class="panel panel-default" id="collapsed_tabs">
3
3
  <div class="panel-body">
4
4
  <div class="tab-wrapper tab-left ">
5
5
  <ul class="nav nav-tabs">
6
- <li class="active"><a href="#general" data-toggle="tab"><i class="fa fa-comment"></i> <%= t("views.admin.generic.comment") %></a></li>
6
+ <li class="active tooltipState" data-toggle="tooltip" data-placement="right" data-title="<%= t("views.admin.generic.comment") %>">
7
+ <a href="#general" data-toggle="tab">
8
+ <i class="fa fa-comment"></i>
9
+ </a>
10
+ </li>
7
11
  </ul>
8
12
  <div class="tab-content">
9
13
  <%= render :partial => 'roroacms/admin/partials/submit_bar' %>
@@ -8,6 +8,7 @@
8
8
  </div>
9
9
  </div>
10
10
  <div class="panel-body">
11
+ <%= render partial: 'roroacms/admin/partials/table_header' %>
11
12
  <%= form_tag bulk_update_admin_comments_path do %>
12
13
  <table id="dtable" class="table table-hover" cellspacing="0" width="100%">
13
14
  <thead>
@@ -50,10 +51,7 @@
50
51
  <div class="btn-group pull-right">
51
52
  <%= link_to edit_admin_comment_path(comment), :class => 'btn btn-xs btn-default' do %>
52
53
  <i class="fa fa-pencil"></i>
53
- <% end %>
54
- <%= link_to mark_as_spam_admin_comment_path(comment), :class => 'btn btn-xs btn-default' do %>
55
- <i class="fa fa-fire"></i>
56
- <% end %>
54
+ <% end %>
57
55
  <%= link_to admin_comment_path(comment), method: :delete, data: { confirm: t("views.admin.generic.confirm") }, :class => 'btn btn-xs btn-danger' do %>
58
56
  <i class="fa fa-trash-o"></i>
59
57
  <% end %>
@@ -72,6 +70,7 @@
72
70
  'mark_as_spam' => t("views.admin.generic.bulk_update_options.mark_as_spam"),
73
71
  'destroy' => t("views.admin.generic.bulk_update_options.destroy")
74
72
  ] %>
73
+ <div id="paginationWrapper"></div>
75
74
  </div>
76
75
  <% end %>
77
76
  </div>
@@ -53,9 +53,6 @@
53
53
  </tbody>
54
54
  </table>
55
55
  </div>
56
- <div class="modal-footer">
57
- <p class="pull-left"><%= t("views.admin.partials.markdown_modal.content") %> <a href="http://daringfireball.net/projects/markdown/syntax" target="_blank"><%= t("views.admin.generic.here") %></a>.</p>
58
- </div>
59
56
  </div>
60
57
  </div>
61
58
  </div>
@@ -15,6 +15,13 @@
15
15
  <i class="fa fa-search"></i>&nbsp;<%= t("views.admin.generic.view") %>
16
16
  <% end %>
17
17
  <% end %>
18
+ <% if defined?(admin_record) && !admin_record.id.blank? %>
19
+ <% if admin_record.overlord != "Y" %>
20
+ <%= link_to admin_administrator_path(admin_record), method: :delete, data: { confirm: t("views.admin.generic.confirm") }, :class => 'btn btn-sm btn-danger pull-left' do %>
21
+ <i class="fa fa-trash-o"></i>&nbsp;<%= t("views.admin.generic.delete") %>
22
+ <% end %>
23
+ <% end %>
24
+ <% end %>
18
25
  <button type="submit" class="btn btn-primary btn-sm pull-right"><i class="fa fa-check"></i>&nbsp;<%= t("views.admin.generic.save") %></button>
19
26
  <% else %>
20
27
  &nbsp;
@@ -18,6 +18,6 @@
18
18
 
19
19
  <% if !@sub.blank? %>
20
20
 
21
- <%= nested_table(@sub, 'admin/partials/term_table_row') %>
21
+ <%= nested_table(@sub, 'roroacms/admin/partials/term_table_row') %>
22
22
 
23
23
  <% end %>
@@ -263,10 +263,10 @@
263
263
  <div class="col-sm-6">
264
264
  <div class="">
265
265
  <label class="radio-inline">
266
- <%= radio_button_tag(:article_comment_type, "R", @settings['article_comment_type'] == 'R' ? true : false) %> <%= t("views.admin.settings.tab_content.system_comments") %>
266
+ <%= radio_button_tag(:article_comment_type, "R", @settings['article_comment_type'] == 'R' && @settings['article_comments'] == 'Y' ? true : false) %> <%= t("views.admin.settings.tab_content.system_comments") %>
267
267
  </label>
268
268
  <label class="radio-inline">
269
- <%= radio_button_tag(:article_comment_type, "F", @settings['article_comment_type'] == 'F' ? true : false) %> <%= t("views.admin.settings.tab_content.facebook_comments") %>
269
+ <%= radio_button_tag(:article_comment_type, "F", @settings['article_comment_type'] == 'F' && @settings['article_comments'] == 'Y' ? true : false) %> <%= t("views.admin.settings.tab_content.facebook_comments") %>
270
270
  </label>
271
271
  </div>
272
272
  </div>
@@ -471,7 +471,7 @@ en:
471
471
  aws_access_key_id: "AWS S3 - Access Key ID"
472
472
  aws_secret_access_key: "AWS S3 - Secret Access Key ID"
473
473
  aws_bucket_name: "AWS S3 - Bucket name"
474
- aws_folder: "AWS S3 - folder name"
474
+ aws_folder: "AWS S3 - prefixed folder structure"
475
475
  url_prefix: "URL prefix"
476
476
  terms:
477
477
  table:
@@ -46,6 +46,8 @@ module Roroacms
46
46
  ApplicationController.helper(ActionView::Helpers::ThemeHelper) if File.exists?("#{Rails.root}/app/helpers/theme_helper.rb")
47
47
  end
48
48
 
49
+ require "#{Roroacms::Engine.root}/app/helpers/roroacms/general_helper.rb"
50
+ require "#{Roroacms::Engine.root}/app/helpers/roroacms/admin_roroa_helper.rb"
49
51
  require "#{Roroacms::Engine.root}/app/models/roroacms/setting.rb"
50
52
 
51
53
  initializer :assets do |config|
@@ -61,6 +63,7 @@ module Roroacms
61
63
  Rails.application.config.assets.precompile += %w( roroacms/roroacms.css ) if File.exists?("#{Dir.pwd}/app/assets/stylesheets/roroacms/roroacms.css")
62
64
  Rails.application.config.assets.precompile += ["theme.css", "theme.js", "theme.scss", "theme.coffee"]
63
65
  Rails.application.config.assets.precompile += ["#{Dir.pwd}/app/views/themes/#{Setting.get('theme_folder')}/assets/*"]
66
+ Rails.application.config.assets.precompile += %w( roroacms/default-profile.jpg )
64
67
 
65
68
  end
66
69
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roroacms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6.7
4
+ version: 0.0.6.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-28 00:00:00.000000000 Z
12
+ date: 2014-08-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails