cortex-reaver 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cortex_reaver/config.rb +13 -0
- data/lib/cortex_reaver/controller/admin.rb +9 -0
- data/lib/cortex_reaver/controller/controller.rb +1 -1
- data/lib/cortex_reaver/helper/common.rb +17 -0
- data/lib/cortex_reaver/layout/blank.rhtml +3 -1
- data/lib/cortex_reaver/model/photograph.rb +3 -12
- data/lib/cortex_reaver/public/css/actions.css +5 -4
- data/lib/cortex_reaver/public/css/admin.css +2 -0
- data/lib/cortex_reaver/public/css/flash.css +41 -9
- data/lib/cortex_reaver/public/css/form.css +6 -1
- data/lib/cortex_reaver/public/css/progress.css +4 -0
- data/lib/cortex_reaver/public/css/tags.css +4 -8
- data/lib/cortex_reaver/public/images/admin/icons.png +0 -0
- data/lib/cortex_reaver/public/images/admin/icons.xcf +0 -0
- data/lib/cortex_reaver/version.rb +1 -1
- data/lib/cortex_reaver/view/admin/configuration.rhtml +4 -1
- metadata +3 -2
data/lib/cortex_reaver/config.rb
CHANGED
@@ -167,6 +167,19 @@ You can also just provide a regex for the path, in which case it is matched dire
|
|
167
167
|
'jquery.hotkeys-0.7.9.js',
|
168
168
|
'cookie.js'
|
169
169
|
]
|
170
|
+
|
171
|
+
define :photographs,
|
172
|
+
:desc => "Photograph configuration options.",
|
173
|
+
:default => Construct.new
|
174
|
+
photographs.define :sizes,
|
175
|
+
:desc => "What sizes of each photograph to maintain.",
|
176
|
+
:default => {
|
177
|
+
:thumbnail => '166x',
|
178
|
+
:grid => '150x150',
|
179
|
+
:small => 'x512',
|
180
|
+
:medium => 'x768',
|
181
|
+
:large => 'x1024'
|
182
|
+
}
|
170
183
|
end
|
171
184
|
|
172
185
|
def compile_views
|
@@ -46,6 +46,15 @@ module CortexReaver
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
# Photographs
|
50
|
+
c.photographs.sizes = Construct.new
|
51
|
+
request['photographs.sizes'].split("\n").each do |line|
|
52
|
+
parts = line.strip.split(' ', 2)
|
53
|
+
if parts.size > 1
|
54
|
+
c.photographs.sizes[parts.first] = parts.last
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
49
58
|
if errors.empty?
|
50
59
|
# Save
|
51
60
|
CortexReaver.instance_variable_set '@config', c
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Ramaze
|
2
|
+
module Helper
|
3
|
+
module Common
|
4
|
+
def flashbox
|
5
|
+
f = ''
|
6
|
+
flash.each do |k, v|
|
7
|
+
f << '<div class="flash ' + k.to_s + '">'
|
8
|
+
f << '<div class="icon"></div>'
|
9
|
+
f << '<div class="body">' + v.to_s + '</div>'
|
10
|
+
f << '<div class="clear"></div>'
|
11
|
+
f << '</div>'
|
12
|
+
end
|
13
|
+
f
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -8,15 +8,6 @@ module CortexReaver
|
|
8
8
|
plugin :sequenceable
|
9
9
|
plugin :viewable
|
10
10
|
|
11
|
-
# Target image sizes
|
12
|
-
SIZES = {
|
13
|
-
:thumbnail => '166x',
|
14
|
-
:grid => '150x150',
|
15
|
-
:small => 'x512',
|
16
|
-
:medium => 'x768',
|
17
|
-
:large => 'x1024',
|
18
|
-
}
|
19
|
-
|
20
11
|
many_to_many :tags, :class => 'CortexReaver::Tag'
|
21
12
|
many_to_one :creator, :class => 'CortexReaver::User', :key => 'created_by'
|
22
13
|
many_to_one :updater, :class => 'CortexReaver::User', :key => 'updated_by'
|
@@ -110,10 +101,11 @@ module CortexReaver
|
|
110
101
|
|
111
102
|
# Regenerates various photo sizes.
|
112
103
|
def regenerate_sizes
|
104
|
+
sizes = CortexReaver.config.photographs.sizes
|
113
105
|
Ramaze::Log.info "Regenerating photo sizes for #{self}"
|
114
106
|
|
115
107
|
# Find existing attachments, in order of decreasing (roughly) size
|
116
|
-
known_files = attachments.map{|a| a.name.sub(/\.jpg$/,'')} & (
|
108
|
+
known_files = attachments.map{|a| a.name.sub(/\.jpg$/,'')} & (sizes.keys.map(&:to_s) + ['original'])
|
117
109
|
largest = attachment(
|
118
110
|
known_files.sort_by { |f|
|
119
111
|
File.stat(attachment("#{f}.jpg").path).size
|
@@ -138,12 +130,11 @@ module CortexReaver
|
|
138
130
|
end
|
139
131
|
|
140
132
|
# Write appropriate sizes to disk
|
141
|
-
|
133
|
+
sizes.each do |size, geometry|
|
142
134
|
image.change_geometry(geometry) do |width, height|
|
143
135
|
attachment = attachment(size.to_s + '.jpg')
|
144
136
|
image.scale(width, height).write(attachment.local_path)
|
145
137
|
end
|
146
|
-
|
147
138
|
end
|
148
139
|
|
149
140
|
# Yep, GC time. Gotta clear out those imagemagick stubs.
|
@@ -23,9 +23,10 @@ ul.actions {
|
|
23
23
|
.footer .actions {
|
24
24
|
font-size: 80%;
|
25
25
|
}
|
26
|
-
|
27
|
-
|
26
|
+
|
27
|
+
.footer .actions li {
|
28
|
+
margin-right: 0.5em;
|
28
29
|
}
|
29
|
-
.footer .actions li:
|
30
|
-
|
30
|
+
.footer .actions li:last-child {
|
31
|
+
margin-right: 0;
|
31
32
|
}
|
@@ -1,17 +1,49 @@
|
|
1
1
|
.flash {
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
padding: 0;
|
3
|
+
font-size: 14px;
|
4
|
+
-webkit-border-radius: 4px;
|
5
|
+
-moz-border-radius: 4px;
|
6
|
+
margin-bottom: 10px;
|
5
7
|
}
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
.flash .icon {
|
10
|
+
float: left;
|
11
|
+
background-image: url('/images/admin/icons.png');
|
12
|
+
background-repeat: no-repeat;
|
13
|
+
height: 32px;
|
14
|
+
width: 32px;
|
15
|
+
margin: 6px;
|
16
|
+
}
|
17
|
+
|
18
|
+
.flash .body {
|
19
|
+
margin: 6px;
|
20
|
+
float: left;
|
21
|
+
}
|
22
|
+
|
23
|
+
.flash.notice {
|
24
|
+
color: #003;
|
10
25
|
background: #e6e6ff;
|
26
|
+
-webkit-box-shadow: 0 1px 2px #88a;
|
27
|
+
}
|
28
|
+
body.photographs .flash.notice {
|
29
|
+
background: #3C3C54;
|
30
|
+
-webkit-box-shadow: none;
|
31
|
+
color: #fff;
|
32
|
+
}
|
33
|
+
.flash.notice .icon {
|
34
|
+
background-position: -224px -32px;
|
11
35
|
}
|
12
36
|
|
13
|
-
|
14
|
-
|
15
|
-
color: #b00;
|
37
|
+
.flash.error {
|
38
|
+
color: #300;
|
16
39
|
background: #ffe6e6;
|
40
|
+
-webkit-box-shadow: 0 1px 2px #a88;
|
41
|
+
}
|
42
|
+
body.photographs .flash.error {
|
43
|
+
background: #541C1C;
|
44
|
+
color: #fff;
|
45
|
+
-webkit-box-shadow: none;
|
46
|
+
}
|
47
|
+
.flash.error .icon {
|
48
|
+
background-position: -256px -32px;
|
17
49
|
}
|
@@ -17,6 +17,10 @@
|
|
17
17
|
color: #fff;
|
18
18
|
padding: 2px 4px 2px 0;
|
19
19
|
height: 12px;
|
20
|
+
-moz-border-radius-topright: 2px;
|
21
|
+
-moz-border-radius-bottomright: 2px;
|
22
|
+
-webkit-border-top-right-radius: 2px;
|
23
|
+
-webkit-border-bottom-right-radius: 2px;
|
20
24
|
}
|
21
25
|
|
22
26
|
.progress .percent_bar {
|
@@ -4,19 +4,15 @@ ul.tags {
|
|
4
4
|
padding: 0px;
|
5
5
|
background: url(/images/tag.gif) no-repeat;
|
6
6
|
background-position: 0px 3px;
|
7
|
-
padding-left:
|
7
|
+
padding-left: 14px;
|
8
8
|
}
|
9
9
|
|
10
10
|
.tags li {
|
11
11
|
display: inline;
|
12
|
+
margin-right: 0.5em;
|
12
13
|
}
|
13
|
-
|
14
|
-
|
15
|
-
content: ', '
|
16
|
-
}
|
17
|
-
|
18
|
-
.tags li:first-child:before {
|
19
|
-
content: none;
|
14
|
+
.tags li:last-child {
|
15
|
+
margin-right: 0;
|
20
16
|
}
|
21
17
|
|
22
18
|
/* Global tags display */
|
Binary file
|
Binary file
|
@@ -11,7 +11,10 @@
|
|
11
11
|
<%= form_p 'site.description', :type => :textarea, :description => 'Description', :default => @config.site.description, :p_class => 'small' %>
|
12
12
|
|
13
13
|
<h3>Navigation</h3>
|
14
|
-
<%= form_p 'view.sections', :type => :textarea, :description => @config.view.schema[:sections][:desc], :default => @config.view.sections.map{ |p| p.join(' ') }.join("\n") %>
|
14
|
+
<%= form_p 'view.sections', :type => :textarea, :description => @config.view.schema[:sections][:desc], :default => @config.view.sections.map{ |p| p.join(' ') }.join("\n"), :p_class => 'medium' %>
|
15
|
+
|
16
|
+
<h3>Photographs</h3>
|
17
|
+
<%= form_p 'photographs.sizes', :type => :textarea, :description => @config.photographs.schema[:sizes][:desc], :default => @config.photographs.sizes.map { |p| p.join(' ') }.join("\n"), :p_class => 'medium' %>
|
15
18
|
|
16
19
|
<input type="submit" value="Update Configuration" />
|
17
20
|
</form>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cortex-reaver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Kingsbury
|
@@ -100,7 +100,7 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.1.
|
103
|
+
version: 0.1.5
|
104
104
|
version:
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: rmagick
|
@@ -320,6 +320,7 @@ files:
|
|
320
320
|
- lib/cortex_reaver/helper/tags.rb
|
321
321
|
- lib/cortex_reaver/helper/auth.rb
|
322
322
|
- lib/cortex_reaver/helper/form.rb
|
323
|
+
- lib/cortex_reaver/helper/common.rb
|
323
324
|
- lib/cortex_reaver/helper/activity.rb
|
324
325
|
- lib/cortex_reaver/helper/date.rb
|
325
326
|
- lib/cortex_reaver/helper/error.rb
|