imagine_cms 3.0.0.beta9 → 3.0.0.beta10
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.
- data/.rvmrc +1 -1
- data/Gemfile.lock +13 -5
- data/README.rdoc +44 -20
- data/app/controllers/management/cms_controller.rb +180 -189
- data/app/helpers/cms_application_helper.rb +7 -1
- data/app/models/cms_page.rb +2 -0
- data/app/{models → sweepers}/cms_content_sweeper.rb +2 -5
- data/app/views/management/cms/_list_page.html.erb +1 -1
- data/app/views/management/cms/_select_gallery.html.erb +3 -78
- data/app/views/management/cms/_upload_image.html.erb +9 -10
- data/app/views/management/cms/pages.html.erb +1 -1
- data/config/initializers/config_file.rb +14 -0
- data/db/migrate/20121108004747_add_settings_table.rb +18 -0
- data/db/migrate/20121108005110_add_tasks_table.rb +17 -0
- data/db/migrate/20121115083748_add_logs_table.rb +28 -0
- data/db/migrate/20121115083811_add_users_tables.rb +43 -0
- data/db/migrate/20121115084028_add_cms_tables.rb +138 -0
- data/imagine_cms.gemspec +6 -5
- data/lib/imagine_cms/engine.rb +2 -1
- data/lib/imagine_cms/version.rb +1 -1
- data/lib/tasks/imagine_cms_tasks.rake +19 -4
- metadata +47 -9
data/.rvmrc
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
imagine_cms (3.0.0.
|
5
|
-
acts_as_tree (~> 1.
|
6
|
-
|
4
|
+
imagine_cms (3.0.0.beta10)
|
5
|
+
acts_as_tree (~> 1.1)
|
6
|
+
aws-s3 (~> 0.6.3)
|
7
|
+
mini_magick (~> 3.3)
|
7
8
|
net-dns (~> 0.7.1)
|
8
|
-
prototype-rails
|
9
|
-
rails (~> 3.2.
|
9
|
+
prototype-rails (~> 3.2.0)
|
10
|
+
rails (~> 3.2.0)
|
10
11
|
rinku (~> 1.7.2)
|
12
|
+
rmagick
|
11
13
|
|
12
14
|
GEM
|
13
15
|
remote: http://rubygems.org/
|
@@ -42,6 +44,10 @@ GEM
|
|
42
44
|
acts_as_tree (1.2.0)
|
43
45
|
activerecord (>= 3.0.0)
|
44
46
|
arel (3.0.2)
|
47
|
+
aws-s3 (0.6.3)
|
48
|
+
builder
|
49
|
+
mime-types
|
50
|
+
xml-simple
|
45
51
|
builder (3.0.4)
|
46
52
|
erubis (2.7.0)
|
47
53
|
hike (1.2.1)
|
@@ -89,6 +95,7 @@ GEM
|
|
89
95
|
rdoc (3.12)
|
90
96
|
json (~> 1.4)
|
91
97
|
rinku (1.7.2)
|
98
|
+
rmagick (2.13.1)
|
92
99
|
sprockets (2.1.3)
|
93
100
|
hike (~> 1.2)
|
94
101
|
rack (~> 1.0)
|
@@ -101,6 +108,7 @@ GEM
|
|
101
108
|
polyglot
|
102
109
|
polyglot (>= 0.3.1)
|
103
110
|
tzinfo (0.3.35)
|
111
|
+
xml-simple (1.1.2)
|
104
112
|
|
105
113
|
PLATFORMS
|
106
114
|
ruby
|
data/README.rdoc
CHANGED
@@ -30,26 +30,50 @@ Imagine 4 will be a clean break from all of these "traditions," and thus will be
|
|
30
30
|
|
31
31
|
Get paid support and hosting for Imagine CMS straight from the people who made it: {Bigger Bird Creative, Inc.}[https://www.biggerbird.com] Neither is required, of course. :-) Free support is up top (Issues).
|
32
32
|
|
33
|
-
=Contributing
|
33
|
+
=Customizing & Contributing
|
34
34
|
|
35
35
|
Pull requests always appreciated (recommend getting in touch first). If companies or individuals are willing to sponsor major features on the roadmap (or features that meet their own needs) development can proceed more quickly.
|
36
36
|
|
37
|
-
=
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
37
|
+
=Migrating from Imagine 2.x
|
38
|
+
|
39
|
+
Putting this at the end because this information may not useful to the general public at the moment. It will evolve over time into a general getting started guide.
|
40
|
+
|
41
|
+
File/code changes:
|
42
|
+
* Rename all .rhtml files to .html.erb, .rxml to .xml.builder
|
43
|
+
* Find and replace: RAILS_ROOT => Rails.root
|
44
|
+
* Find and replace: SITE_ROOT => Rails.root
|
45
|
+
* Find and replace: RAILS_ENV => Rails.env (not all instances: constants only, leave environment variables)
|
46
|
+
|
47
|
+
Assets:
|
48
|
+
* Delete prototype.js, effect.js, controls.js, dragdrop.js, imagine.js, reset.css, manage.css; move everything else to assets
|
49
|
+
* Create symlinks to assets in public (images, javascripts, stylesheets, files)
|
50
|
+
|
51
|
+
Config changes:
|
52
|
+
* Move constants from config/environment.rb to config/initializers/imagine_cms.rb. Use Object.send(:remove_const, :ConstantName) as needed to override default values (bit of a stupid workaround but it works).
|
53
|
+
* Create config/amazon_s3.yml and add AWS account credentials (preferably IAM, not master account)
|
54
|
+
|
55
|
+
Third party libraries no longer included:
|
56
|
+
* Install fop in vendor/ if needed.
|
57
|
+
|
58
|
+
Layout changes:
|
59
|
+
* Under app/views/application: Update three partial paths: 'shared/ccs_header' => 'imagine_cms/header', 'shared/ccs_toolbar' => 'imagine_cms/toolbar', '/management/dialogs' => 'imagine_cms/dialogs'
|
60
|
+
* Add: <%= csrf_meta_tags %>
|
61
|
+
* Change to standard Rails includes, plus print:
|
62
|
+
<%= stylesheet_link_tag 'application', :media => 'all' %>
|
63
|
+
<%= stylesheet_link_tag 'print', :media => 'print' %>
|
64
|
+
<%= javascript_include_tag 'application' %>
|
65
|
+
|
66
|
+
View changes:
|
67
|
+
* Change <% form_tag do %> and similar to <%= form_tag %>
|
68
|
+
|
69
|
+
Major functions that were (re)moved, and how to get them back:
|
70
|
+
* script/clear_cache: Use rake imagine_cms:cache:clear
|
71
|
+
* Exception emails: Install exception_notifier gem and add to config/environments/production.rb:
|
72
|
+
config.middleware.use ExceptionNotifier,
|
73
|
+
:email_prefix => "[EXCEPTION] ",
|
74
|
+
:sender_address => %{"Exception Notifier" <sender@example.com>},
|
75
|
+
:exception_recipients => %w{recipient@example.com}
|
76
|
+
|
77
|
+
Recommended Rails config changes:
|
78
|
+
* config.assets.compile = true (optional, easy way out for sites with a lot of customizations)
|
79
|
+
* config.assets.precompile += %w( ... ) (if compile = false, this must be updated properly)
|
@@ -602,6 +602,7 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
|
|
602
602
|
@pg.published_version = params[:pg][:published_version]
|
603
603
|
@pg.update_index
|
604
604
|
@pg.save_without_revision
|
605
|
+
logger.debug @pg.errors.full_messages.inspect
|
605
606
|
end
|
606
607
|
end
|
607
608
|
|
@@ -713,51 +714,24 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
|
|
713
714
|
|
714
715
|
def receive_image
|
715
716
|
@pg = CmsPage.find_by_id(params[:id])
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
unless params[:overwrite].to_i == 1
|
731
|
-
count = 0
|
732
|
-
while File.exists?(localfile)
|
733
|
-
count += 1
|
734
|
-
localfile = File.join(target_dir, File.basename(original_filename, File.extname(original_filename))) + "-#{count}" + File.extname(original_filename)
|
735
|
-
end
|
736
|
-
end
|
737
|
-
|
738
|
-
begin
|
739
|
-
File.open(localfile, 'wb') { |f| f.write('test') }
|
740
|
-
rescue Exception => e
|
741
|
-
logger.debug "Exception: #{e}"
|
742
|
-
log_error(e)
|
743
|
-
finish_upload_status "''" and return
|
744
|
-
end
|
745
|
-
|
746
|
-
begin
|
747
|
-
File.open(localfile, 'wb') { |f| f.write(data.read) }
|
748
|
-
rescue Exception => e
|
749
|
-
logger.debug "Exception: #{e}"
|
750
|
-
log_error(e)
|
751
|
-
finish_upload_status "''" and return
|
717
|
+
|
718
|
+
data = params[:file][:data]
|
719
|
+
original_filename = data.original_filename
|
720
|
+
target_dir = File.join(Rails.root, 'public', 'assets', 'content', @pg.path)
|
721
|
+
localfile = File.join(target_dir, original_filename)
|
722
|
+
|
723
|
+
FileUtils.mkdir_p target_dir
|
724
|
+
|
725
|
+
unless params[:overwrite].to_i == 1
|
726
|
+
count = 0
|
727
|
+
while File.exists?(localfile)
|
728
|
+
count += 1
|
729
|
+
localfile = File.join(target_dir, File.basename(original_filename, File.extname(original_filename))) + "-#{count}" + File.extname(original_filename)
|
752
730
|
end
|
753
|
-
rescue Exception => e
|
754
|
-
logger.debug params.inspect
|
755
|
-
# logger.debug "Exception: #{e}"
|
756
|
-
log_error(e)
|
757
|
-
finish_upload_status "''" and return
|
758
731
|
end
|
759
732
|
|
760
|
-
|
733
|
+
FileUtils.cp(data.tempfile, localfile)
|
734
|
+
|
761
735
|
finish_upload_status "'#{File.basename(localfile)}'" and return
|
762
736
|
end
|
763
737
|
|
@@ -768,6 +742,8 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
|
|
768
742
|
# get out now if user clicked finish
|
769
743
|
if params[:next_clicked].to_i != 1
|
770
744
|
@image_file = localfile
|
745
|
+
upload_to_s3(localfile, @pg)
|
746
|
+
|
771
747
|
render :partial => 'crop_results' and return
|
772
748
|
end
|
773
749
|
|
@@ -832,6 +808,7 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
|
|
832
808
|
orig_im.write(localfile) if dirty
|
833
809
|
@image_file = localfile
|
834
810
|
File.unlink testfile
|
811
|
+
upload_to_s3(localfile, @pg)
|
835
812
|
|
836
813
|
render :partial => 'crop_results'
|
837
814
|
end
|
@@ -883,8 +860,6 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
|
|
883
860
|
entries.each_with_index do |zipentry, index|
|
884
861
|
upload_progress.message = "Extracting #{File.basename(zipentry.name)}"
|
885
862
|
ext = File.extname(zipentry.name)
|
886
|
-
#name = File.basename(zipentry.name, ext)
|
887
|
-
#localfile = File.join(localdir, 'temp', name.downcase.gsub(/[^\w\d]/, '') + ext.downcase)
|
888
863
|
localfile = File.join(localdir, 'temp', (index+1).to_s + ext.downcase)
|
889
864
|
jpgfile = File.join(localdir, 'temp', (index+1).to_s + '.jpg')
|
890
865
|
|
@@ -1396,8 +1371,6 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
|
|
1396
1371
|
|
1397
1372
|
x1 = params[:image][:x1].to_i * scale
|
1398
1373
|
y1 = params[:image][:y1].to_i * scale
|
1399
|
-
# x2 = params[:image][:x2].to_i * scale
|
1400
|
-
# y2 = params[:image][:y2].to_i * scale
|
1401
1374
|
width = params[:image][:width].to_i * scale
|
1402
1375
|
height = params[:image][:height].to_i * scale
|
1403
1376
|
|
@@ -1480,8 +1453,6 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
|
|
1480
1453
|
|
1481
1454
|
x1 = params[:image][:x1].to_i * scale
|
1482
1455
|
y1 = params[:image][:y1].to_i * scale
|
1483
|
-
# x2 = params[:image][:x2].to_i * scale
|
1484
|
-
# y2 = params[:image][:y2].to_i * scale
|
1485
1456
|
width = params[:image][:width].to_i * scale
|
1486
1457
|
height = params[:image][:height].to_i * scale
|
1487
1458
|
|
@@ -1515,168 +1486,188 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
|
|
1515
1486
|
end
|
1516
1487
|
|
1517
1488
|
|
1518
|
-
|
1489
|
+
protected
|
1519
1490
|
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1491
|
+
def load_page_objects
|
1492
|
+
@page_objects = HashObject.new
|
1493
|
+
@template_options = HashObject.new
|
1494
|
+
|
1495
|
+
if @pg.new_record? && @parent
|
1496
|
+
# This does not appear to be a beneficial feature any longer
|
1497
|
+
# @tags = @parent.tags.collect { |t| t.name }.join(', ')
|
1498
|
+
@parent.objects.find(:all, :conditions => [ "obj_type = 'attribute'" ]).each do |obj|
|
1499
|
+
key = "obj-#{obj.obj_type.to_s}-#{obj.name}"
|
1500
|
+
@page_objects[key] = obj.content
|
1501
|
+
end
|
1502
|
+
@parent.objects.find(:all, :conditions => [ "obj_type = 'option'" ]).each do |obj|
|
1503
|
+
key = "obj-#{obj.obj_type.to_s}-#{obj.name}"
|
1504
|
+
@page_objects[key] = obj.content
|
1505
|
+
end
|
1506
|
+
else
|
1507
|
+
@tags = @pg.tags.collect { |t| t.name }.join(', ')
|
1508
|
+
@pg.objects.find(:all, :conditions => [ "obj_type = 'attribute'" ]).each do |obj|
|
1509
|
+
key = "obj-#{obj.obj_type.to_s}-#{obj.name}"
|
1510
|
+
@page_objects[key] = obj.content
|
1511
|
+
end
|
1512
|
+
@pg.objects.find(:all, :conditions => [ "obj_type = 'option'" ]).each do |obj|
|
1513
|
+
key = "obj-#{obj.obj_type.to_s}-#{obj.name}"
|
1514
|
+
@page_objects[key] = obj.content
|
1515
|
+
end
|
1544
1516
|
end
|
1545
1517
|
end
|
1546
|
-
end
|
1547
|
-
|
1548
|
-
def load_template_options
|
1549
|
-
begin
|
1550
|
-
render_to_string :inline => @pg.template.content
|
1551
|
-
rescue Exception => e
|
1552
|
-
logger.debug e
|
1553
|
-
end
|
1554
|
-
end
|
1555
|
-
|
1556
|
-
def garbage_collect
|
1557
|
-
GC.start
|
1558
|
-
end
|
1559
|
-
|
1560
|
-
def create_captions_file(pg_id, options = {})
|
1561
|
-
gallery_id = (!options[:gallery_id] ? params[:gallery_id] : options[:gallery_id])
|
1562
|
-
|
1563
|
-
@pg = CmsPage.find_by_id(pg_id)
|
1564
|
-
galleries_dir = File.join(Rails.root, 'public', 'images', 'content', @pg.path)
|
1565
|
-
gallery_dir = File.join(galleries_dir, gallery_id)
|
1566
|
-
captions_location = File.join(gallery_dir, 'captions.yml')
|
1567
|
-
|
1568
|
-
return if File.exists?(captions_location)
|
1569
|
-
|
1570
|
-
File.open(captions_location, 'w') { |f| YAML.dump([0], f) }
|
1571
|
-
end
|
1572
|
-
|
1573
|
-
# prerequisites: @pg (CmsPage)
|
1574
|
-
def load_gallery_settings_from_file(gallery_id, options = {})
|
1575
|
-
galleries_dir = File.join(Rails.root, 'public', 'images', 'content', @pg.path)
|
1576
|
-
gallery_dir = File.join(galleries_dir, gallery_id)
|
1577
|
-
settings_location = File.join(gallery_dir, 'settings.yml')
|
1578
1518
|
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1519
|
+
def load_template_options
|
1520
|
+
begin
|
1521
|
+
render_to_string :inline => @pg.template.content
|
1522
|
+
rescue Exception => e
|
1523
|
+
logger.debug e
|
1524
|
+
end
|
1585
1525
|
end
|
1586
1526
|
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
return HashObject.new(ret)
|
1592
|
-
end
|
1593
|
-
|
1594
|
-
# prerequisites: @pg (CmsPage)
|
1595
|
-
def save_gallery_settings_to_file(gallery_id, settings_hash, options = {})
|
1596
|
-
settings_hash = settings_hash.hash if settings_hash.kind_of?(HashObject)
|
1597
|
-
|
1598
|
-
galleries_dir = File.join(Rails.root, 'public', 'images', 'content', @pg.path)
|
1599
|
-
gallery_dir = File.join(galleries_dir, gallery_id)
|
1600
|
-
settings_location = File.join(gallery_dir, 'settings.yml')
|
1601
|
-
|
1602
|
-
File.open(settings_location, 'w') { |f| YAML.dump(settings_hash, f) }
|
1603
|
-
end
|
1604
|
-
|
1605
|
-
def resize_image(localfile)
|
1606
|
-
ext = File.extname(localfile)
|
1607
|
-
|
1608
|
-
# AKN: this would change all files to jpeg format... commenting out for now
|
1609
|
-
# filename = File.join(File.dirname(localfile), File.basename(localfile, ext) + '.jpg')
|
1610
|
-
filename = localfile
|
1611
|
-
|
1612
|
-
im = MiniMagick::Image::from_file(localfile)
|
1527
|
+
def garbage_collect
|
1528
|
+
GC.start
|
1529
|
+
end
|
1613
1530
|
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1531
|
+
def create_captions_file(pg_id, options = {})
|
1532
|
+
gallery_id = (!options[:gallery_id] ? params[:gallery_id] : options[:gallery_id])
|
1533
|
+
|
1534
|
+
@pg = CmsPage.find_by_id(pg_id)
|
1535
|
+
galleries_dir = File.join(Rails.root, 'public', 'images', 'content', @pg.path)
|
1536
|
+
gallery_dir = File.join(galleries_dir, gallery_id)
|
1537
|
+
captions_location = File.join(gallery_dir, 'captions.yml')
|
1538
|
+
|
1539
|
+
return if File.exists?(captions_location)
|
1540
|
+
|
1541
|
+
File.open(captions_location, 'w') { |f| YAML.dump([0], f) }
|
1619
1542
|
end
|
1620
1543
|
|
1621
|
-
|
1544
|
+
# prerequisites: @pg (CmsPage)
|
1545
|
+
def load_gallery_settings_from_file(gallery_id, options = {})
|
1546
|
+
galleries_dir = File.join(Rails.root, 'public', 'images', 'content', @pg.path)
|
1547
|
+
gallery_dir = File.join(galleries_dir, gallery_id)
|
1548
|
+
settings_location = File.join(gallery_dir, 'settings.yml')
|
1549
|
+
|
1550
|
+
ret = {}
|
1551
|
+
|
1552
|
+
if File.exists?(settings_location)
|
1553
|
+
File.open(settings_location, 'r') { |f| ret = YAML.load(f.read) }
|
1554
|
+
else
|
1555
|
+
File.open(settings_location, 'w') { |f| YAML.dump({}, f) }
|
1556
|
+
end
|
1557
|
+
|
1558
|
+
# set a few defaults
|
1559
|
+
ret[:slide_duration] ||= 0
|
1560
|
+
ret[:show_thumbs] ||= true
|
1561
|
+
|
1562
|
+
return HashObject.new(ret)
|
1563
|
+
end
|
1622
1564
|
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1565
|
+
# prerequisites: @pg (CmsPage)
|
1566
|
+
def save_gallery_settings_to_file(gallery_id, settings_hash, options = {})
|
1567
|
+
settings_hash = settings_hash.hash if settings_hash.kind_of?(HashObject)
|
1568
|
+
|
1569
|
+
galleries_dir = File.join(Rails.root, 'public', 'images', 'content', @pg.path)
|
1570
|
+
gallery_dir = File.join(galleries_dir, gallery_id)
|
1571
|
+
settings_location = File.join(gallery_dir, 'settings.yml')
|
1572
|
+
|
1573
|
+
File.open(settings_location, 'w') { |f| YAML.dump(settings_hash, f) }
|
1574
|
+
end
|
1628
1575
|
|
1629
|
-
|
1630
|
-
|
1631
|
-
im = Magick::Image::read(src_file)[0]
|
1632
|
-
im_overlay = Magick::Image::read(File.join(Rails.root, 'public', 'images', 'management', overlay))[0]
|
1576
|
+
def resize_image(localfile)
|
1577
|
+
ext = File.extname(localfile)
|
1633
1578
|
|
1634
|
-
|
1635
|
-
|
1579
|
+
# AKN: this would change all files to jpeg format... commenting out for now
|
1580
|
+
# filename = File.join(File.dirname(localfile), File.basename(localfile, ext) + '.jpg')
|
1581
|
+
filename = localfile
|
1636
1582
|
|
1637
|
-
im
|
1638
|
-
File.chmod(0644, dest)
|
1583
|
+
im = MiniMagick::Image::from_file(localfile)
|
1639
1584
|
|
1640
|
-
im
|
1641
|
-
|
1585
|
+
if im[:width] > GalleryMaxWidth || im[:height] > GalleryMaxHeight
|
1586
|
+
im.resize("#{GalleryMaxWidth}x#{GalleryMaxHeight}")
|
1587
|
+
im.write(filename)
|
1588
|
+
elsif filename != localfile
|
1589
|
+
im.write(filename)
|
1590
|
+
end
|
1591
|
+
|
1592
|
+
File.unlink(localfile) unless localfile == filename
|
1642
1593
|
|
1643
|
-
|
1594
|
+
filename
|
1644
1595
|
end
|
1645
|
-
end
|
1646
|
-
|
1647
|
-
def create_preview_images(options = {})
|
1648
|
-
# assumes @pg has already been set before calling
|
1649
1596
|
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
FileUtils.mkdir_p(management_dir) unless File.exists?(management_dir)
|
1658
|
-
|
1659
|
-
images = Dir.glob("#{g}/*.{jpg,jpeg,png,gif}")
|
1660
|
-
preview_images = []
|
1661
|
-
images.each { |img| preview_images << img unless File.basename(img).include?('thumb') }
|
1597
|
+
def create_preview_image(src_file, dest, force = 0, overlay = 'gallery_small_overlay.png', thumb_size = 90)
|
1598
|
+
require 'RMagick'
|
1599
|
+
|
1600
|
+
dest = File.join(dest, File.basename(src_file)) if File.directory?(dest)
|
1601
|
+
if !File.exists?(dest) || force == 1
|
1602
|
+
im = Magick::Image::read(src_file)[0]
|
1603
|
+
im_overlay = Magick::Image::read(File.join(Rails.root, 'public', 'images', 'management', overlay))[0]
|
1662
1604
|
|
1663
|
-
|
1664
|
-
|
1665
|
-
unless File.exists?(preview_image_location)
|
1666
|
-
preview_image = preview_images.first
|
1667
|
-
create_preview_image(preview_image, preview_image_location, options[:force], 'gallery_preview_overlay.png', 130)
|
1668
|
-
end
|
1605
|
+
im.crop_resized!(thumb_size, thumb_size)
|
1606
|
+
im = im.composite(im_overlay, Magick::CenterGravity, Magick::OverCompositeOp)
|
1669
1607
|
|
1670
|
-
|
1671
|
-
|
1608
|
+
im.write(dest)
|
1609
|
+
File.chmod(0644, dest)
|
1672
1610
|
|
1673
|
-
|
1674
|
-
|
1675
|
-
session[:broken_galleries] << File.basename(g)
|
1611
|
+
im = im_overlay = nil
|
1612
|
+
GC.start
|
1676
1613
|
|
1677
|
-
|
1614
|
+
nil
|
1678
1615
|
end
|
1679
1616
|
end
|
1680
|
-
|
1681
|
-
|
1617
|
+
|
1618
|
+
def create_preview_images(options = {})
|
1619
|
+
# assumes @pg has already been set before calling
|
1620
|
+
|
1621
|
+
galleries_dir = File.join(Rails.root, 'public', 'images', 'content', @pg.path)
|
1622
|
+
session[:broken_galleries] = []
|
1623
|
+
|
1624
|
+
# create preview images if not already made
|
1625
|
+
Dir.glob("#{galleries_dir}/gallery_*").each do |g|
|
1626
|
+
begin
|
1627
|
+
management_dir = File.join(g, 'management')
|
1628
|
+
FileUtils.mkdir_p(management_dir) unless File.exists?(management_dir)
|
1629
|
+
|
1630
|
+
images = Dir.glob("#{g}/*.{jpg,jpeg,png,gif}")
|
1631
|
+
preview_images = []
|
1632
|
+
images.each { |img| preview_images << img unless File.basename(img).include?('thumb') }
|
1633
|
+
|
1634
|
+
# gallery preview image
|
1635
|
+
preview_image_location = File.join(management_dir, 'preview.jpg')
|
1636
|
+
unless File.exists?(preview_image_location)
|
1637
|
+
preview_image = preview_images.first
|
1638
|
+
create_preview_image(preview_image, preview_image_location, options[:force], 'gallery_preview_overlay.png', 130)
|
1639
|
+
end
|
1640
|
+
|
1641
|
+
# photo preview images
|
1642
|
+
preview_images.each { |img| create_preview_image(img, management_dir, options[:force]) }
|
1643
|
+
|
1644
|
+
rescue Exception => e
|
1645
|
+
# some error handling here
|
1646
|
+
session[:broken_galleries] << File.basename(g)
|
1647
|
+
|
1648
|
+
log_error(e)
|
1649
|
+
end
|
1650
|
+
end
|
1651
|
+
end
|
1652
|
+
|
1653
|
+
def upload_to_s3(filename, page)
|
1654
|
+
s3retries = 0
|
1655
|
+
s3success = false
|
1656
|
+
|
1657
|
+
|
1658
|
+
if ImagineCmsConfig['amazon_s3'] && ImagineCmsConfig['amazon_s3']['enabled']
|
1659
|
+
filename = File.join(Rails.root, 'public', 'assets', 'content', page.path, File.basename(filename))
|
1660
|
+
prefix = ImagineCmsConfig['amazon_s3'][Rails.env]['image_prefix']
|
1661
|
+
bucket = ImagineCmsConfig['amazon_s3'][Rails.env]['image_bucket']
|
1662
|
+
while s3retries < 2 && !s3success
|
1663
|
+
response = AWS::S3::S3Object.store("#{prefix}/#{page.path.blank? ? 'index' : page.path}/#{File.basename(filename)}", open(filename), bucket, :access => :public_read)
|
1664
|
+
s3success = response.code == 200
|
1665
|
+
s3retries += 1
|
1666
|
+
end
|
1667
|
+
File.unlink(filename) if s3success
|
1668
|
+
end
|
1669
|
+
|
1670
|
+
s3success
|
1671
|
+
end
|
1672
|
+
|
1682
1673
|
end
|
@@ -1097,7 +1097,13 @@ EOF
|
|
1097
1097
|
end
|
1098
1098
|
|
1099
1099
|
def page_image_tag(page, filename)
|
1100
|
-
|
1100
|
+
if ImagineCmsConfig['amazon_s3'] && ImagineCmsConfig['amazon_s3']['enabled']
|
1101
|
+
prefix = ImagineCmsConfig['amazon_s3'][Rails.env]['image_prefix']
|
1102
|
+
hostname = ImagineCmsConfig['amazon_s3'][Rails.env]['image_hostname']
|
1103
|
+
"<img src=\"//#{hostname}/#{prefix}/#{page.path.blank? ? 'index' : page.path}/#{File.basename(filename)}\" alt=\"#{File.basename(filename, '.*').sub(/-[[:xdigit:]]{32}\z/, '').capitalize}\" />".html_safe
|
1104
|
+
else
|
1105
|
+
"<img src=\"/#{File.join('assets', 'content', page.path, File.basename(filename))}\" alt=\"#{File.basename(filename, '.*').sub(/-[[:xdigit:]]{32}\z/, '').capitalize}\" />".html_safe
|
1106
|
+
end
|
1101
1107
|
end
|
1102
1108
|
|
1103
1109
|
def copyright_year(year)
|
data/app/models/cms_page.rb
CHANGED
@@ -10,12 +10,9 @@ class CmsContentSweeper < ActionController::Caching::Sweeper
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def delete_all_cached_pages
|
13
|
-
CmsPage.
|
13
|
+
CmsPage.find_each do |page|
|
14
14
|
expire_page :controller => 'cms/content', :action => 'show', :content_path => page.path.split('/')
|
15
15
|
end
|
16
|
-
|
17
|
-
# also delete RSS feed caches
|
18
|
-
expire_fragment %r{rss/\d+/}
|
19
16
|
end
|
20
17
|
|
21
|
-
end
|
18
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="<%= "cb_item_#{list_page.id}" %>" class="cb_item" style="width: 148px; overflow: hidden; margin: 2px; float: left; cursor: pointer" onclick="$('view_link').href = '
|
1
|
+
<div id="<%= "cb_item_#{list_page.id}" %>" class="cb_item" style="width: 148px; overflow: hidden; margin: 2px; float: left; cursor: pointer" onclick="$('view_link').href = '<%= list_page.path.blank? ? '' : '/' + list_page.path %>/version/<%= list_page.published_version > 0 ? list_page.published_version : list_page.version %>'; $('new_link').onclick = function () { editProperties('<%=raw url_for :action => 'edit_page', :mode => 'ajax_new', :parent_id => list_page, :authenticity_token => form_authenticity_token.to_s %>', 'Create New Page under /<%= list_page.path %>'); return false; }; $('edit_link').onclick = function () { editProperties('<%=raw url_for :action => 'edit_page', :id => list_page, :mode => 'ajax_edit', :authenticity_token => form_authenticity_token.to_s %>', 'Page Properties: <%= list_page.name %>'); return false; }; $('edit_content_link').href = '<%=raw url_for :action => 'edit_page_content', :id => list_page, :authenticity_token => form_authenticity_token.to_s %>'; $('delete_form').action = '<%=raw url_for :action => 'delete_page', :id => list_page.id, :authenticity_token => form_authenticity_token.to_s %>'; setTimeout('cbSelectItem(\'' + this.id + '\', <%= @page_level %>, \'<%=raw url_for :action => 'list_pages', :level => @page_level + 1, :parent_id => list_page.id, :authenticity_token => form_authenticity_token.to_s %>\');', 200);" ondblclick="$('edit_content_form').onsubmit(); $('edit_content_form').submit();">
|
2
2
|
<table cellpadding="0" cellspacing="0" border="0">
|
3
3
|
<tr>
|
4
4
|
<td valign="top"><img src="/assets/management/icon_page.gif" style="margin: 2px 5px 0 0; "/></td>
|
@@ -1,13 +1,8 @@
|
|
1
1
|
<div id="delete_gallery_container">
|
2
|
-
<%- unless @galleries.size > 0 -%>
|
3
|
-
<div id="save_errors" class="error"></div>
|
4
|
-
<h3 style="margin-bottom: 10px;">Insert Image</h3>
|
5
|
-
<%- end -%>
|
6
|
-
|
7
2
|
<div id="select_gallery_container">
|
8
3
|
|
9
4
|
<%- if session[:broken_galleries] and session[:broken_galleries].size > 0 -%>
|
10
|
-
<div id="
|
5
|
+
<div id="broken_galleries" style="margin-bottom: 10px; padding: 10px; background-color: #ffa7b9; border: 2px solid #f03;">
|
11
6
|
<p><b>The following galleries have problems and require fixing:</b></p>
|
12
7
|
<ul style="padding: 0; margin: 0 0 0 15px; list-style-type: disc;">
|
13
8
|
<%- session[:broken_galleries].sort.each do |g| -%>
|
@@ -20,9 +15,7 @@
|
|
20
15
|
</div>
|
21
16
|
<%- end -%>
|
22
17
|
|
23
|
-
<%-
|
24
|
-
if @galleries.size > 0
|
25
|
-
-%>
|
18
|
+
<%- if @galleries.size > 0 -%>
|
26
19
|
<div id="select_gallery">
|
27
20
|
<h2>Select gallery</h2>
|
28
21
|
<%-
|
@@ -44,74 +37,6 @@
|
|
44
37
|
<br style="clear: both" />
|
45
38
|
</div>
|
46
39
|
<%- end -%>
|
47
|
-
|
48
|
-
<fieldset>
|
49
|
-
<legend>Single Image</legend>
|
50
|
-
|
51
|
-
<p>Select an image, then click "Finish" to upload and insert it if you are
|
52
|
-
certain your image is already web-ready. Otherwise, click "Next" to crop and
|
53
|
-
resize your image before using it.</p>
|
54
|
-
|
55
|
-
<%= form_tag_with_upload_progress({ :action => 'receive_image', :id => @pg },
|
56
|
-
{ :finish => "if (arguments[0]) { $('filename').value = arguments[0]; $('mainform').onsubmit(); }" }) do -%>
|
57
|
-
<table>
|
58
|
-
<tr>
|
59
|
-
<td width="70">Image file:</td>
|
60
|
-
<td><%= file_field 'file', 'data', :class => 'form', :style => 'margin-bottom: 0; width: 150px' %></td>
|
61
|
-
</tr>
|
62
|
-
<tr>
|
63
|
-
<td></td>
|
64
|
-
<td><span style="color: #888888">Valid image types: jpeg, png, gif</span></td>
|
65
|
-
</tr>
|
66
|
-
<tr>
|
67
|
-
<td></td>
|
68
|
-
<td>
|
69
|
-
<div id="upload_status_div" class="error"><%= upload_status_tag %></div>
|
70
|
-
<%= submit_tag 'Next', :class => 'form_button', :style => 'width: 70px;', :onclick => "if ($('file_data').value == '') return false; $('next_clicked_upload').value = '1'; $('next_clicked').value = '1'; this.disabled = true; this.value = 'Uploading...';" %>
|
71
|
-
<%= submit_tag 'Finish', :class => 'form_button', :style => 'width: 70px;', :onclick => "if ($('file_data').value == '') return false; this.disabled = true; this.value = 'Uploading...';" %>
|
72
|
-
<%= link_to_function "Cancel", "cancelInsertImage()" %>
|
73
|
-
<%= text_field_tag 'next_clicked_upload', '0', :style => 'display: none' %>
|
74
|
-
</td>
|
75
|
-
</tr>
|
76
|
-
</table>
|
77
|
-
<%- end -%>
|
78
|
-
</fieldset><br/>
|
79
40
|
|
80
|
-
|
81
|
-
<legend>New Photo Gallery</legend>
|
82
|
-
|
83
|
-
<p>Upload a zip file of images to create a photo gallery.</p>
|
84
|
-
|
85
|
-
<%= form_tag_with_upload_progress({ :action => 'receive_gallery', :id => @pg },
|
86
|
-
{ :finish => "if (arguments[0]) { $('dirname').value = arguments[0]; $('mainform_gallery').onsubmit(); }" }) do -%>
|
87
|
-
<table>
|
88
|
-
<tr>
|
89
|
-
<td width="70">Zip file:</td>
|
90
|
-
<td>
|
91
|
-
<%= file_field 'gallery_file', 'data', :class => 'form', :style => 'margin-bottom: 0; width: 150px' %><br/>
|
92
|
-
</td>
|
93
|
-
</tr>
|
94
|
-
<tr>
|
95
|
-
<td></td>
|
96
|
-
<td>
|
97
|
-
<div id="upload_status_div" class="error"><%= upload_status_tag %></div>
|
98
|
-
<%= submit_tag 'Next', :class => 'form_button', :style => 'width: 70px;', :onclick => "if ($('gallery_file_data').value == '') return false; this.disabled = true; this.value = 'Uploading...';" %>
|
99
|
-
<%= link_to_function "Cancel", "cancelInsertImage()" %>
|
100
|
-
</td>
|
101
|
-
</tr>
|
102
|
-
</table>
|
103
|
-
<%- end -%>
|
104
|
-
</fieldset><br/>
|
105
|
-
|
106
|
-
<%= form_remote_tag(:update => 'insert_image_dialog_content', :html => { :id => 'mainform' },
|
107
|
-
:url => { :action => 'crop_image', :id => @pg }) do -%>
|
108
|
-
<%= text_field_tag 'next_clicked', '0', :style => 'display: none' %>
|
109
|
-
<%= text_field_tag 'filename', '', :style => 'display: none' %>
|
110
|
-
<%- end -%>
|
111
|
-
|
112
|
-
<%= form_remote_tag(:update => 'insert_image_dialog_content', :html => { :id => 'mainform_gallery' },
|
113
|
-
:url => { :action => 'gallery_setup', :id => @pg }) do -%>
|
114
|
-
<%= text_field_tag :dirname, '', :style => 'display: none' %>
|
115
|
-
<%- end -%>
|
116
|
-
</div>
|
41
|
+
<%= render :partial => 'upload_image' %>
|
117
42
|
</div>
|
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
<fieldset>
|
7
7
|
<legend>Single Image</legend>
|
8
|
-
|
8
|
+
|
9
9
|
<p>Select an image, then click "Finish" to upload and insert it if you are
|
10
10
|
certain your image is already web-ready. Otherwise, click "Next" to crop and
|
11
11
|
resize your image before using it.</p>
|
12
|
-
|
12
|
+
|
13
13
|
<%= form_tag_with_upload_progress({ :action => 'receive_image', :id => @pg },
|
14
|
-
{ :finish => "if (arguments[0]
|
15
|
-
<table>
|
14
|
+
{ :finish => "if (arguments[0]) { $('filename').value = arguments[0]; $('mainform').onsubmit(); }" }) do -%>
|
15
|
+
<table>
|
16
16
|
<tr>
|
17
17
|
<td width="70">Image file:</td>
|
18
18
|
<td><%= file_field 'file', 'data', :class => 'form', :style => 'margin-bottom: 0; width: 150px' %></td>
|
@@ -33,14 +33,13 @@
|
|
33
33
|
</tr>
|
34
34
|
</table>
|
35
35
|
<%- end -%>
|
36
|
-
</fieldset
|
37
|
-
<br/>
|
36
|
+
</fieldset><br/>
|
38
37
|
|
39
38
|
<fieldset>
|
40
|
-
<legend>Photo Gallery</legend>
|
41
|
-
|
39
|
+
<legend>New Photo Gallery</legend>
|
40
|
+
|
42
41
|
<p>Upload a zip file of images to create a photo gallery.</p>
|
43
|
-
|
42
|
+
|
44
43
|
<%= form_tag_with_upload_progress({ :action => 'receive_gallery', :id => @pg },
|
45
44
|
{ :finish => "if (arguments[0]) { $('dirname').value = arguments[0]; $('mainform_gallery').onsubmit(); }" }) do -%>
|
46
45
|
<table>
|
@@ -60,7 +59,7 @@
|
|
60
59
|
</tr>
|
61
60
|
</table>
|
62
61
|
<%- end -%>
|
63
|
-
</fieldset
|
62
|
+
</fieldset><br/>
|
64
63
|
|
65
64
|
<%= form_remote_tag(:update => 'insert_image_dialog_content', :html => { :id => 'mainform' },
|
66
65
|
:url => { :action => 'crop_image', :id => @pg }) do -%>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
config_file = File.join(Rails.root, 'config', 'imagine_cms.yml')
|
2
|
+
|
3
|
+
if File.exists?(config_file)
|
4
|
+
ImagineCmsConfig = YAML.load(File.read(config_file))
|
5
|
+
|
6
|
+
if ImagineCmsConfig['amazon_s3'] && ImagineCmsConfig['amazon_s3']['enabled']
|
7
|
+
AWS::S3::Base.establish_connection!(
|
8
|
+
:access_key_id => ImagineCmsConfig['amazon_s3'][Rails.env]['access_key_id'],
|
9
|
+
:secret_access_key => ImagineCmsConfig['amazon_s3'][Rails.env]['secret_access_key']
|
10
|
+
)
|
11
|
+
end
|
12
|
+
else
|
13
|
+
ImagineCmsConfig = {}
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class AddSettingsTable < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def up
|
4
|
+
create_table "settings" do |t|
|
5
|
+
t.column "name", :string, :null => false
|
6
|
+
t.column "value", :text
|
7
|
+
|
8
|
+
t.column "created_on", :timestamp
|
9
|
+
t.column "updated_on", :timestamp
|
10
|
+
end
|
11
|
+
add_index "settings", ["name"], :name => "UN_settings_name", :unique => true
|
12
|
+
end
|
13
|
+
|
14
|
+
def down
|
15
|
+
drop_table "settings"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class AddTasksTable < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def up
|
4
|
+
create_table "tasks" do |t|
|
5
|
+
t.column "name", :string, :null => false
|
6
|
+
|
7
|
+
t.column "created_on", :timestamp
|
8
|
+
t.column "updated_on", :timestamp
|
9
|
+
end
|
10
|
+
add_index "tasks", ["name"], :name => "UN_tasks_name", :unique => true
|
11
|
+
end
|
12
|
+
|
13
|
+
def down
|
14
|
+
drop_table "tasks"
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class AddLogsTable < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def up
|
4
|
+
create_table "logs" do |t|
|
5
|
+
t.column "name", :string
|
6
|
+
t.column "description", :text
|
7
|
+
|
8
|
+
t.column "created_on", :timestamp
|
9
|
+
end
|
10
|
+
|
11
|
+
create_table "log_entries" do |t|
|
12
|
+
t.column "log_id", :integer, :null => false
|
13
|
+
|
14
|
+
t.column "type", :string, :null => false
|
15
|
+
t.column "description", :text
|
16
|
+
t.column "data", :text
|
17
|
+
|
18
|
+
t.column "created_on", :timestamp
|
19
|
+
end
|
20
|
+
add_index "log_entries", ["type"], :name => "IDX_log_entries_type"
|
21
|
+
end
|
22
|
+
|
23
|
+
def down
|
24
|
+
drop_table "log_entries"
|
25
|
+
drop_table "logs"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class AddUsersTables < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table "users" do |t|
|
5
|
+
t.column "username", :string
|
6
|
+
t.column "password_hash", :string, :limit => 100
|
7
|
+
|
8
|
+
t.column "first_name", :string, :limit => 100
|
9
|
+
t.column "last_name", :string, :limit => 100
|
10
|
+
|
11
|
+
t.column "dynamic_fields", :text
|
12
|
+
|
13
|
+
t.column "active", :integer, :default => 1, :null => false
|
14
|
+
t.column "is_superuser", :integer, :default => 0, :null => false
|
15
|
+
|
16
|
+
t.column "created_on", :timestamp
|
17
|
+
t.column "updated_on", :timestamp
|
18
|
+
end
|
19
|
+
add_index "users", ["username"], :name => "UN_users_username", :unique => true
|
20
|
+
|
21
|
+
create_table "user_groups" do |t|
|
22
|
+
t.column "name", :string
|
23
|
+
|
24
|
+
t.column "created_on", :timestamp
|
25
|
+
t.column "updated_on", :timestamp
|
26
|
+
end
|
27
|
+
add_index "user_groups", ["name"], :name => "UN_user_groups_name", :unique => true
|
28
|
+
|
29
|
+
create_table "user_group_memberships", :id => false do |t|
|
30
|
+
t.column "user_id", :integer, :null => false
|
31
|
+
t.column "user_group_id", :integer, :null => false
|
32
|
+
t.column "created_on", :timestamp
|
33
|
+
end
|
34
|
+
execute 'alter table user_group_memberships add constraint PK_user_group_memberships primary key (user_id, user_group_id)'
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.down
|
38
|
+
drop_table "user_group_memberships"
|
39
|
+
drop_table "user_groups"
|
40
|
+
drop_table "users"
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
class AddCmsTables < ActiveRecord::Migration
|
2
|
+
|
3
|
+
class CmsTemplate < ActiveRecord::Base ; acts_as_versioned ; end
|
4
|
+
class CmsSnippet < ActiveRecord::Base ; acts_as_versioned ; end
|
5
|
+
class CmsPage < ActiveRecord::Base ; acts_as_versioned ; end
|
6
|
+
|
7
|
+
def self.up
|
8
|
+
create_table "cms_templates" do |t|
|
9
|
+
t.column "name", :string
|
10
|
+
t.column "content", :text
|
11
|
+
t.column "options_yaml", :text
|
12
|
+
|
13
|
+
t.column "version", :integer, :default => 0, :null => false
|
14
|
+
|
15
|
+
t.column "created_on", :timestamp
|
16
|
+
t.column "updated_on", :timestamp
|
17
|
+
end
|
18
|
+
CmsTemplate.create_versioned_table # => CmsTemplateVersions
|
19
|
+
|
20
|
+
create_table "cms_snippets" do |t|
|
21
|
+
t.column "name", :string
|
22
|
+
t.column "content", :text
|
23
|
+
|
24
|
+
t.column "version", :integer, :default => 0, :null => false
|
25
|
+
|
26
|
+
t.column "created_on", :timestamp
|
27
|
+
t.column "updated_on", :timestamp
|
28
|
+
end
|
29
|
+
CmsSnippet.create_versioned_table # => CmsSnippetVersions
|
30
|
+
|
31
|
+
create_table "cms_pages" do |t|
|
32
|
+
t.column "cms_template_id", :integer, :null => false
|
33
|
+
t.column "cms_template_version", :integer, :null => false
|
34
|
+
|
35
|
+
t.column "parent_id", :integer, :references => :cms_pages
|
36
|
+
|
37
|
+
t.column "name", :string
|
38
|
+
t.column "title", :string
|
39
|
+
t.column "path", :text
|
40
|
+
t.column "article_date", :datetime
|
41
|
+
t.column "article_end_date", :datetime
|
42
|
+
|
43
|
+
t.column "summary", :text
|
44
|
+
t.column "thumbnail_path", :string, :limit => 255
|
45
|
+
t.column "feature_image_path", :string, :limit => 255
|
46
|
+
t.column "position", :integer, :default => 0
|
47
|
+
t.column "comment_count", :integer, :default => 0
|
48
|
+
|
49
|
+
t.column "version", :integer, :default => 0, :null => false
|
50
|
+
t.column "published_version", :integer, :default => 0, :null => false
|
51
|
+
t.column "published_date", :datetime, :null => false
|
52
|
+
t.column "expiration_date", :datetime
|
53
|
+
t.column "expires", :boolean, :default => false
|
54
|
+
t.column "search_index", :text
|
55
|
+
t.column "html_head", :text
|
56
|
+
|
57
|
+
t.column "updated_by", :integer, :null => false
|
58
|
+
t.column "updated_by_username", :string, :null => false
|
59
|
+
|
60
|
+
t.column "created_on", :timestamp
|
61
|
+
t.column "updated_on", :timestamp
|
62
|
+
end
|
63
|
+
CmsPage.create_versioned_table # => CmsPageVersions
|
64
|
+
|
65
|
+
create_table "cms_page_objects" do |t|
|
66
|
+
t.column "cms_page_id", :integer, :null => false
|
67
|
+
t.column "cms_page_version", :integer, :null => false
|
68
|
+
|
69
|
+
t.column "name", :string
|
70
|
+
t.column "obj_type", :string # one of [ :text, :asset ]
|
71
|
+
t.column "content", :text # if :text, then text; if :asset, then asset_id
|
72
|
+
t.column "options", :text # options hash
|
73
|
+
|
74
|
+
t.column "created_on", :timestamp
|
75
|
+
t.column "updated_on", :timestamp
|
76
|
+
end
|
77
|
+
|
78
|
+
create_table "cms_page_tags" do |t|
|
79
|
+
t.column "cms_page_id", :integer, :null => false
|
80
|
+
t.column "name", :string, :null => false
|
81
|
+
t.column "created_on", :timestamp
|
82
|
+
end
|
83
|
+
|
84
|
+
create_table "cms_page_comments" do |t|
|
85
|
+
t.column "cms_page_id", :integer, :null => false
|
86
|
+
|
87
|
+
t.column "owner", :string, :null => false
|
88
|
+
t.column "owner_url", :string, :limit => 255
|
89
|
+
t.column "owner_email", :string, :limit => 255
|
90
|
+
t.column "content", :text
|
91
|
+
|
92
|
+
t.column "created_on", :timestamp
|
93
|
+
t.column "updated_on", :timestamp
|
94
|
+
end
|
95
|
+
|
96
|
+
create_table "cms_assets" do |t|
|
97
|
+
t.column "name", :string
|
98
|
+
t.column "content_type", :string
|
99
|
+
|
100
|
+
t.column "created_on", :timestamp
|
101
|
+
t.column "updated_on", :timestamp
|
102
|
+
end
|
103
|
+
|
104
|
+
create_table "cms_asset_tags" do |t|
|
105
|
+
t.column "cms_asset_id", :integer, :null => false
|
106
|
+
t.column "user_id", :integer, :null => false
|
107
|
+
t.column "name", :string
|
108
|
+
|
109
|
+
t.column "created_on", :timestamp
|
110
|
+
t.column "updated_on", :timestamp
|
111
|
+
end
|
112
|
+
|
113
|
+
execute 'create index cms_snippets_name_index on cms_snippets (name(255))'
|
114
|
+
execute 'create index cms_pages_path_index on cms_pages (path(255))'
|
115
|
+
execute 'create index cms_page_objects_cms_page_id_obj_type_index on cms_page_objects (cms_page_id, obj_type)'
|
116
|
+
execute 'create index cms_page_objects_cms_page_id_cms_page_version_index on cms_page_objects (cms_page_id, cms_page_version)'
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.down
|
120
|
+
execute 'drop index cms_page_objects_cms_page_id_cms_page_version_index on cms_page_objects'
|
121
|
+
execute 'drop index cms_page_objects_cms_page_id_obj_type_index on cms_page_objects'
|
122
|
+
execute 'drop index cms_pages_path_index on cms_pages'
|
123
|
+
execute 'drop index cms_snippets_name_index on cms_snippets'
|
124
|
+
|
125
|
+
drop_table "cms_asset_tags"
|
126
|
+
drop_table "cms_assets"
|
127
|
+
drop_table "cms_page_comments"
|
128
|
+
drop_table "cms_page_tags"
|
129
|
+
drop_table "cms_page_objects"
|
130
|
+
drop_table "cms_page_versions"
|
131
|
+
drop_table "cms_pages"
|
132
|
+
drop_table "cms_snippet_versions"
|
133
|
+
drop_table "cms_snippets"
|
134
|
+
drop_table "cms_template_versions"
|
135
|
+
drop_table "cms_templates"
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
data/imagine_cms.gemspec
CHANGED
@@ -22,13 +22,14 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
23
|
s.require_paths = ["lib"]
|
24
24
|
|
25
|
-
s.add_dependency "rails", "~> 3.2.
|
26
|
-
s.add_dependency "prototype-rails"
|
27
|
-
|
28
|
-
s.add_dependency "
|
25
|
+
s.add_dependency "rails", "~> 3.2.0"
|
26
|
+
s.add_dependency "prototype-rails", "~> 3.2.0"
|
27
|
+
s.add_dependency "aws-s3", "~> 0.6.3"
|
28
|
+
s.add_dependency "rmagick"
|
29
|
+
s.add_dependency "mini_magick", "~> 3.3"
|
29
30
|
s.add_dependency "rinku", "~> 1.7.2"
|
30
31
|
s.add_dependency "net-dns", "~> 0.7.1"
|
31
|
-
s.add_dependency "acts_as_tree", "~> 1.
|
32
|
+
s.add_dependency "acts_as_tree", "~> 1.1"
|
32
33
|
|
33
34
|
s.add_development_dependency "sqlite3"
|
34
35
|
end
|
data/lib/imagine_cms/engine.rb
CHANGED
data/lib/imagine_cms/version.rb
CHANGED
@@ -1,4 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
namespace :imagine_cms do
|
2
|
+
|
3
|
+
namespace :cache do
|
4
|
+
|
5
|
+
desc "Clear CMS cache (generated .html files)"
|
6
|
+
task :clear => :environment do
|
7
|
+
include ActionDispatch::Routing::UrlFor
|
8
|
+
include Rails.application.routes.url_helpers
|
9
|
+
|
10
|
+
CmsPage.find_each do |page|
|
11
|
+
ActionController::Base.expire_page url_for(:controller => 'cms/content', :action => 'show', :content_path => page.path, :only_path => true)
|
12
|
+
end
|
13
|
+
|
14
|
+
puts "Cache cleared."
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imagine_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.beta10
|
5
5
|
prerelease: 6
|
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: 2012-11-
|
12
|
+
date: 2012-11-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.
|
21
|
+
version: 3.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,9 +26,41 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.2.
|
29
|
+
version: 3.2.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: prototype-rails
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 3.2.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.2.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: aws-s3
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.6.3
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.6.3
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rmagick
|
32
64
|
requirement: !ruby/object:Gem::Requirement
|
33
65
|
none: false
|
34
66
|
requirements:
|
@@ -50,7 +82,7 @@ dependencies:
|
|
50
82
|
requirements:
|
51
83
|
- - ~>
|
52
84
|
- !ruby/object:Gem::Version
|
53
|
-
version: '3.
|
85
|
+
version: '3.3'
|
54
86
|
type: :runtime
|
55
87
|
prerelease: false
|
56
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +90,7 @@ dependencies:
|
|
58
90
|
requirements:
|
59
91
|
- - ~>
|
60
92
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
93
|
+
version: '3.3'
|
62
94
|
- !ruby/object:Gem::Dependency
|
63
95
|
name: rinku
|
64
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +130,7 @@ dependencies:
|
|
98
130
|
requirements:
|
99
131
|
- - ~>
|
100
132
|
- !ruby/object:Gem::Version
|
101
|
-
version: '1.
|
133
|
+
version: '1.1'
|
102
134
|
type: :runtime
|
103
135
|
prerelease: false
|
104
136
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +138,7 @@ dependencies:
|
|
106
138
|
requirements:
|
107
139
|
- - ~>
|
108
140
|
- !ruby/object:Gem::Version
|
109
|
-
version: '1.
|
141
|
+
version: '1.1'
|
110
142
|
- !ruby/object:Gem::Dependency
|
111
143
|
name: sqlite3
|
112
144
|
requirement: !ruby/object:Gem::Requirement
|
@@ -293,7 +325,6 @@ files:
|
|
293
325
|
- app/controllers/management/users_controller.rb
|
294
326
|
- app/controllers/util_controller.rb
|
295
327
|
- app/helpers/cms_application_helper.rb
|
296
|
-
- app/models/cms_content_sweeper.rb
|
297
328
|
- app/models/cms_page.rb
|
298
329
|
- app/models/cms_page_object.rb
|
299
330
|
- app/models/cms_page_tag.rb
|
@@ -301,6 +332,7 @@ files:
|
|
301
332
|
- app/models/cms_snippet.rb
|
302
333
|
- app/models/cms_template.rb
|
303
334
|
- app/models/user.rb
|
335
|
+
- app/sweepers/cms_content_sweeper.rb
|
304
336
|
- app/views/errors/404.html.erb
|
305
337
|
- app/views/errors/permission_denied.html.erb
|
306
338
|
- app/views/imagine_cms/_dialogs.html.erb
|
@@ -366,8 +398,14 @@ files:
|
|
366
398
|
- app/views/util/_message.html.erb
|
367
399
|
- app/views/util/_show_message.js.erb
|
368
400
|
- app/views/util/_tab.html.erb
|
401
|
+
- config/initializers/config_file.rb
|
369
402
|
- config/initializers/constants.rb
|
370
403
|
- config/routes.rb
|
404
|
+
- db/migrate/20121108004747_add_settings_table.rb
|
405
|
+
- db/migrate/20121108005110_add_tasks_table.rb
|
406
|
+
- db/migrate/20121115083748_add_logs_table.rb
|
407
|
+
- db/migrate/20121115083811_add_users_tables.rb
|
408
|
+
- db/migrate/20121115084028_add_cms_tables.rb
|
371
409
|
- imagine_cms.gemspec
|
372
410
|
- lib/acts_as_versioned/.document
|
373
411
|
- lib/acts_as_versioned/.gitignore
|