etabliocms_core 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/admin-core.js +1 -0
- data/app/assets/javascripts/admin.js +6 -6
- data/app/assets/stylesheets/admin-core.css +1 -0
- data/app/assets/stylesheets/admin.css.scss +1 -1
- data/app/helpers/etabliocms_core/admin/table_tree_helper.rb +16 -11
- data/app/helpers/etabliocms_core/application_helper.rb +0 -19
- data/app/helpers/etabliocms_core/output_helper.rb +1 -3
- data/app/views/layouts/admin.html.erb +2 -1
- data/config/initializers/configatron.rb +0 -1
- data/config/locales/core.cs.yml +1 -0
- data/lib/etabliocms_core/engine.rb +6 -1
- data/lib/etabliocms_core/version.rb +1 -1
- data/lib/form_helper.rb +7 -7
- metadata +34 -13
- data/app/helpers/etabliocms_core/pages_helper.rb +0 -33
@@ -1,11 +1,11 @@
|
|
1
1
|
var Admin = function() {
|
2
2
|
|
3
3
|
return {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
initPopUp : function() {
|
5
|
+
$('a[data-popup=true]').click(function(e) {
|
6
|
+
e.preventDefault();
|
7
|
+
window.open($(this).attr('href'));
|
8
|
+
})
|
9
|
+
}
|
10
10
|
}
|
11
11
|
}();
|
@@ -120,7 +120,7 @@ header#topbar { color: white; font-weight: bold; background: $background_dark; p
|
|
120
120
|
/* FORM */
|
121
121
|
fieldset { border:0; clear:both;
|
122
122
|
p {clear:both; margin: 10px 0 20px 0; }
|
123
|
-
legend { font-size:1.5em; font-weight:normal; }
|
123
|
+
legend { font-size:1.5em; font-weight:normal; margin-bottom: 10px; }
|
124
124
|
label {color: $grey; width: 80px; padding-right:10px; display:block; float:left; text-align:right; margin-top: 3px }
|
125
125
|
select { margin:0; }
|
126
126
|
textarea { width: 500px;
|
@@ -30,24 +30,29 @@ module EtabliocmsCore
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def item_html(item, stack)
|
33
|
+
title, locale = if defined?(EtabliocmsPages::Page) && item.is_a?(EtabliocmsPages::Page)
|
34
|
+
[item.titles, item.locales]
|
35
|
+
else
|
36
|
+
[item.title, item.locale]
|
37
|
+
end
|
33
38
|
html = [
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
39
|
+
link_to(title, edit_path(item), :style => "padding-left:#{stack.size*10}px"),
|
40
|
+
content_tag(:span, I18n.l(item.created_at, :format => :short), :class => "centered"),
|
41
|
+
content_tag(:span, locale, :class => 'centered'),
|
42
|
+
actions_links(item, stack.last)
|
38
43
|
].inject("") { |line, cell_content| line + content_tag(:td, cell_content) }
|
39
44
|
content_tag(:tr, html.html_safe)
|
40
45
|
end
|
41
46
|
|
42
47
|
def actions_links(item, parent)
|
43
48
|
links = [
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
49
|
+
link_to(I18n.t('admin.edit'), edit_path(item),
|
50
|
+
:class => "icon icon-edit",
|
51
|
+
:title => I18n.t('admin.edit')),
|
52
|
+
link_to(I18n.t('admin.destroy'), destroy_path(item),
|
53
|
+
:method => :delete,
|
54
|
+
:confirm => t("#{item.class.to_s.demodulize.underscore}.destroy_confirmation"),
|
55
|
+
:class => 'icon icon-destroy', :title => I18n.t('admin.destroy'))
|
51
56
|
]
|
52
57
|
unless item.is_first_of_siblings?(parent)
|
53
58
|
links << link_to(I18n.t('hierarchy.up'), move_path(item, "move_higher"),
|
@@ -5,7 +5,6 @@ module EtabliocmsCore
|
|
5
5
|
module ApplicationHelper
|
6
6
|
|
7
7
|
include OutputHelper
|
8
|
-
include PagesHelper
|
9
8
|
|
10
9
|
def add_breadcrumb(title, url = nil)
|
11
10
|
@breadcrumbs << OpenStruct.new(:title => title, :url => url)
|
@@ -30,23 +29,5 @@ module EtabliocmsCore
|
|
30
29
|
"#{qualified_controller_name} #{qualified_controller_name}-#{controller.action_name}"
|
31
30
|
end
|
32
31
|
|
33
|
-
def render_sidebar?
|
34
|
-
return false if params[:action] == 'index' && params[:controller] == 'pages'
|
35
|
-
return false if params[:action] == 'search' && params[:controller] == 'pages'
|
36
|
-
return false if params[:controller] == 'devise/sessions'
|
37
|
-
true
|
38
|
-
end
|
39
|
-
|
40
|
-
def other_locale
|
41
|
-
case I18n.locale.to_s
|
42
|
-
when 'cs'
|
43
|
-
'en'
|
44
|
-
when 'en'
|
45
|
-
'cs'
|
46
|
-
else
|
47
|
-
'cs'
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
32
|
end
|
52
33
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module EtabliocmsCore::OutputHelper
|
2
2
|
|
3
|
-
def html_out(
|
4
|
-
return "" if obj.nil?
|
5
|
-
string = obj.send(method)
|
3
|
+
def html_out(string = "", options = {})
|
6
4
|
string = RedCloth.new(string.to_s)
|
7
5
|
string = string.to_html(:textile, :tags)
|
8
6
|
string = truncate_and_strip_tags(string, options[:words].to_i) if options[:words]
|
@@ -25,7 +25,8 @@
|
|
25
25
|
<% if etabliocms_core_user_signed_in? -%>
|
26
26
|
<strong><%= t('common.logged') %>: <%= link_to current_etabliocms_core_user.email, admin_path %></strong>
|
27
27
|
<ul>
|
28
|
-
<li><%= link_to t('
|
28
|
+
<li><%= link_to I18n.t('admin.show_public', :domain => request.host), "/", :'data-popup' => true %></li>
|
29
|
+
<li><%= link_to I18n.t('common.logout'), destroy_etabliocms_core_user_session_path, {:title => t('common.logout'), :method => :delete} %></li>
|
29
30
|
</ul>
|
30
31
|
<% end -%>
|
31
32
|
|
@@ -1 +0,0 @@
|
|
1
|
-
#TODO make configatron work
|
data/config/locales/core.cs.yml
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
require 'devise'
|
2
|
+
require 'configatron'
|
3
|
+
require 'redcloth'
|
4
|
+
require 'jquery-rails'
|
5
|
+
require 'jquery-ui-rails'
|
6
|
+
|
1
7
|
module EtabliocmsCore
|
2
8
|
|
3
9
|
class Engine < ::Rails::Engine
|
@@ -24,7 +30,6 @@ module EtabliocmsCore
|
|
24
30
|
end
|
25
31
|
end
|
26
32
|
|
27
|
-
|
28
33
|
end
|
29
34
|
|
30
35
|
end
|
data/lib/form_helper.rb
CHANGED
@@ -6,20 +6,20 @@ module ActionView
|
|
6
6
|
DEFAULT_TEXTAREA_HEIGHT = 200
|
7
7
|
|
8
8
|
def boolean_yes_no_select(object_name, method, options = {}, html_options = {})
|
9
|
-
choices =
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
choices = [
|
10
|
+
['Ano', true],
|
11
|
+
['Ne', false],
|
12
|
+
]
|
13
13
|
InstanceTag.new(object_name, method, self, options.delete(:object)).to_select_tag(choices, options, html_options)
|
14
14
|
end
|
15
15
|
|
16
16
|
def textile_text_area(object_name, method, options = {})
|
17
|
-
obj = self.instance_variable_get("@#{object_name}")
|
18
17
|
html = InstanceTag.new(object_name, method, self, options.delete(:object)).to_text_area_tag(options)
|
18
|
+
id = options[:id] || "#{object_name}_#{method}"
|
19
19
|
html << javascript_tag do
|
20
20
|
%Q(
|
21
21
|
$(function() {
|
22
|
-
$('##{
|
22
|
+
$('##{id}').markItUp(mySettings);
|
23
23
|
});
|
24
24
|
)
|
25
25
|
end
|
@@ -37,4 +37,4 @@ module ActionView
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
|
-
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etabliocms_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &7572500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,32 @@ dependencies:
|
|
21
21
|
version: 3.2.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *7572500
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: jquery-rails
|
27
|
+
requirement: &7572080 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *7572080
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: jquery-ui-rails
|
38
|
+
requirement: &7571600 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *7571600
|
25
47
|
- !ruby/object:Gem::Dependency
|
26
48
|
name: devise
|
27
|
-
requirement: &
|
49
|
+
requirement: &7571080 !ruby/object:Gem::Requirement
|
28
50
|
none: false
|
29
51
|
requirements:
|
30
52
|
- - ~>
|
@@ -32,10 +54,10 @@ dependencies:
|
|
32
54
|
version: 2.0.4
|
33
55
|
type: :runtime
|
34
56
|
prerelease: false
|
35
|
-
version_requirements: *
|
57
|
+
version_requirements: *7571080
|
36
58
|
- !ruby/object:Gem::Dependency
|
37
59
|
name: configatron
|
38
|
-
requirement: &
|
60
|
+
requirement: &7567560 !ruby/object:Gem::Requirement
|
39
61
|
none: false
|
40
62
|
requirements:
|
41
63
|
- - ! '>='
|
@@ -43,10 +65,10 @@ dependencies:
|
|
43
65
|
version: '0'
|
44
66
|
type: :runtime
|
45
67
|
prerelease: false
|
46
|
-
version_requirements: *
|
68
|
+
version_requirements: *7567560
|
47
69
|
- !ruby/object:Gem::Dependency
|
48
70
|
name: RedCloth
|
49
|
-
requirement: &
|
71
|
+
requirement: &7566940 !ruby/object:Gem::Requirement
|
50
72
|
none: false
|
51
73
|
requirements:
|
52
74
|
- - =
|
@@ -54,10 +76,10 @@ dependencies:
|
|
54
76
|
version: 4.2.9
|
55
77
|
type: :runtime
|
56
78
|
prerelease: false
|
57
|
-
version_requirements: *
|
79
|
+
version_requirements: *7566940
|
58
80
|
- !ruby/object:Gem::Dependency
|
59
81
|
name: sqlite3
|
60
|
-
requirement: &
|
82
|
+
requirement: &7566480 !ruby/object:Gem::Requirement
|
61
83
|
none: false
|
62
84
|
requirements:
|
63
85
|
- - ! '>='
|
@@ -65,7 +87,7 @@ dependencies:
|
|
65
87
|
version: '0'
|
66
88
|
type: :development
|
67
89
|
prerelease: false
|
68
|
-
version_requirements: *
|
90
|
+
version_requirements: *7566480
|
69
91
|
description: Small CMS
|
70
92
|
email:
|
71
93
|
- patrikjira@gmail.com
|
@@ -147,7 +169,6 @@ files:
|
|
147
169
|
- app/models/etabliocms_core/user.rb
|
148
170
|
- app/helpers/etabliocms_core/output_helper.rb
|
149
171
|
- app/helpers/etabliocms_core/admin/table_tree_helper.rb
|
150
|
-
- app/helpers/etabliocms_core/pages_helper.rb
|
151
172
|
- app/helpers/etabliocms_core/application_helper.rb
|
152
173
|
- config/routes.rb
|
153
174
|
- config/initializers/configatron.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module EtabliocmsCore::PagesHelper
|
2
|
-
|
3
|
-
def render_tree(nodes = [])
|
4
|
-
html = ""
|
5
|
-
nodes.select { |node| node.visible }.each do |node|
|
6
|
-
html << "<li class='#{'no-divider' if node == nodes.last && node.level == 0 }'>"
|
7
|
-
html << page_link(node)
|
8
|
-
html << render_tree(node.children) if node.children.present? && actual?(node)
|
9
|
-
html << "</li>"
|
10
|
-
end
|
11
|
-
content_tag(:ul, html.html_safe)
|
12
|
-
end
|
13
|
-
|
14
|
-
def page_link(node)
|
15
|
-
link_to(node.title, node.url.present? ? node.url : page_path(node),
|
16
|
-
:class => node_class(node),
|
17
|
-
:style => "padding-left: #{node.level*10 + 15}px").html_safe
|
18
|
-
end
|
19
|
-
|
20
|
-
def actual?(node)
|
21
|
-
if node.url.present?
|
22
|
-
(node.url =~ /zeptejte-se/ && params[:controller] == 'questions') || false
|
23
|
-
else
|
24
|
-
@page.present? ? @page.self_and_ancestors.include?(node) : false
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def node_class(node)
|
30
|
-
actual?(node) ? 'active' : 'inactive'
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|