Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 85aebcb
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Tue Nov 1 17:58:37 2011 +0100

    Picture in element layout fixes

commit 4b713d1
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Tue Nov 1 17:58:21 2011 +0100

    Fixes switching of standard and flash uploader

commit 962913a
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Tue Nov 1 17:57:59 2011 +0100

    Fixes a bug with single quote strings in update page notice

commit da87cee
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Tue Nov 1 17:20:55 2011 +0100

    Changes License to BSD and prepared readme for release

commit 67e3764
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Tue Nov 1 16:48:40 2011 +0100

    RSS Feed refactoring and fixes.

    You can now define elements that shroud be in your feed and mark contents as rss title and rss description.

commit 055dbaa
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Tue Nov 1 13:12:27 2011 +0100

    Standardset styling for searchresults

commit 7d0c30a
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Tue Nov 1 13:09:02 2011 +0100

    Standardset styling

commit 8c17a82
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Tue Nov 1 13:08:47 2011 +0100

    Refactored search results

commit 582d1ae
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Tue Nov 1 13:08:21 2011 +0100

    Error messages translation

commit 28d72c0
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Tue Nov 1 13:08:06 2011 +0100

    Setting trashed elements not public

commit b48ee02
Author: Robin Böning <robin.boening@nethosting4you.de>
Date:   Tue Nov 1 10:33:45 2011 +0100

    Fixes page caching. Closes #84

commit 235f497
Merge: 9ef37be f1d23e7
Author: Robin Böning <robin.boening@nethosting4you.de>
Date:   Tue Nov 1 10:14:58 2011 +0100

    Merge branch 'next_stable' of github.com:magiclabs/alchemy_cms into next_stable

    Conflicts:
    	lib/rails/generators/alchemy/plugin/templates/config.yml

commit 9ef37be
Author: Robin Böning <robin.boening@nethosting4you.de>
Date:   Tue Nov 1 10:08:57 2011 +0100

    adds description for icon

commit f1d23e7
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Tue Nov 1 10:05:08 2011 +0100

    Fixes cache sweeping. Closes #85

commit 89354cd
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Mon Oct 31 20:44:27 2011 +0100

    Fixes bug in standard set contact form view

commit 9c9833a
Merge: 62875e7 a04df11
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Mon Oct 31 20:27:07 2011 +0100

    Merge branch 'next_stable' of github.com:magiclabs/alchemy_cms into next_stable

commit 62875e7
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Mon Oct 31 20:26:26 2011 +0100

    Fixes a bug in TrashController where trashed Elements could not be rendered

commit a04df11
Author: Robin Böning <robin@magiclabs.de>
Date:   Mon Oct 31 00:36:21 2011 +0100

    fixes Issue #81 - render_elements method finds a Page regardless of the language when using fallback option

commit 2d5e80f
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Sun Oct 30 21:33:24 2011 +0100

    rc6

commit 9da9e8e
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Sun Oct 30 21:17:14 2011 +0100

    Fixes bug in where a content could not be updated via ajax

commit aca1a96
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Fri Oct 28 21:54:49 2011 +0200

    Radiobutton style and default for button enabling

commit c2ce897
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Fri Oct 28 20:47:38 2011 +0200

    Adding a small button class

commit fc7685f
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Fri Oct 28 19:17:21 2011 +0200

    Refactors plugin generator Rails 3 style

commit 8bbf373
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Fri Oct 28 17:45:01 2011 +0200

    Updating jQuery and jQuery UI.

    And adding new modules autocomplete and datepicker

commit 6244fa2
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Fri Oct 28 17:44:19 2011 +0200

    Slight layout fixes

commit fe8f3c7
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Thu Oct 27 18:22:34 2011 +0200

    Overlay bg color

commit 0104304
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Thu Oct 27 17:59:28 2011 +0200

    Some layout fixes

commit 0260d4e
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Thu Oct 27 17:42:13 2011 +0200

    Fresh new GUI

commit 1dbebc8
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Wed Oct 26 19:58:29 2011 +0200

    Reverts the changes of authorization files declaration

commit 36c929b
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Wed Oct 26 19:27:54 2011 +0200

    Fixes auth files declaration

commit 1fce9ca
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Wed Oct 26 18:08:30 2011 +0200

    Removes authorization_rules loading from plugins

commit 0d60344
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Wed Oct 26 17:57:00 2011 +0200

    Fixes issue #80: Installer fails under Ruby 1.9

commit 0b9b1fd
Author: Thomas von Deyen <tvd@magiclabs.de>
Date:   Wed Oct 26 13:50:15 2011 +0200

    Fixes Gem dependencies

commit a102009
Merge: 49515e9 81cff2b
Author: Thomas von Deyen <tvdeyen@gmail.com>
Date:   Wed Oct 26 00:43:03 2011 -0700

    Merge pull request #79 from masche842/next_stable

    Yaml-Syntax

commit 81cff2b
Author: masche842 <marc@zilia.com>
Date:   Wed Oct 26 14:49:16 2011 +0800

    changed syntax in locales to be compatible with psych

commit 49515e9
Author: Thomas von Deyen <tvdeyen@gmail.com>
Date:   Tue Oct 25 00:53:29 2011 +0300

    Update README.md
  • Loading branch information
Thomas von Deyen committed Nov 1, 2011
1 parent d7d09d6 commit 43f26df
Show file tree
Hide file tree
Showing 51 changed files with 958 additions and 1,109 deletions.
643 changes: 24 additions & 619 deletions LICENSE

Large diffs are not rendered by default.

62 changes: 26 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,20 @@ Alchemy CMS
About
-----

**CAUTION: This branch is a pre alpha development branch. For productive environments use [master](https://github.com/magiclabs/alchemy_cms), or [next_stable](https://github.com/magiclabs/alchemy_cms/tree/next_stable) branch.**

Alchemy is a fully featured Content Management System (CMS) with an gorgeous Userinterface.

Nearly every content management system stores the content of a page in a body column in the pages table. This is easy to develop and the user manages the content inside one of the fancy new Javascript based wysiwyg processors. Formatting, image placement, styling and positioning of the content is in the hand of the end-user.

__We think this is completly wrong!__

The content manager mustn‘t be able to change anything but the content and some basic text formatting. The content manager shouldn‘t care about headline formatting, image positioning or resizing. The developer should take care of this!

__Alchemy is different!__

We split the page into logical parts like headlines, paragraphs, images, etc. The only thing we store in the database is text: ids of images and richtext content. Nothing else. No markup (besides basic text formatting inside the richtext elements), no styling, no layout. Pure content!

This gives the webdeveloper the power and flexibility to implement any kind of layout with the insurance that the content manager is not able to break up the layout.
Alchemy is a powerfull Content Management System (CMS) with an extremly flexible content storing architecture.

Features
--------

- Highly flexible Templating:
- Content is stored in small parts not as a complete, monolithic page.
- Content is stored in small parts not as a complete, monolithic page
- The designer chooses the template structure, not the CMS!
- Every Design is possible, no templating, or theming restrictions.
- Every Design is possible, no templating, or theming restrictions
- Even Flash® Content Management is possible
- Gorgious End-User centric interface:
- No geeky markup editors and other meta programming crap.
- No markup editors
- Multilingual:
- Create as many (complete independent) language trees as you want.
- Create as many (complete independent) language trees as you want
- URL based language switching
- SEO
- Every Part of SEO is manageable by the user
Expand All @@ -41,6 +27,7 @@ Features
- Rolebased Authentification (RBAS)
- Protect pages for restricted access
- Fulltext Search
- RSS Feeds
- Contactforms
- Attachments and downloads
- Powerfull image rendering
Expand All @@ -54,7 +41,7 @@ Features
- Integrates in exsiting Rails Apps
- Caching
- Completely free:
- GPLv3 License
- BSD License
- No Enterprise Licences, or Community Editions
- Hostable on any Server that supports RubyOnRails and ImageMagick ([Software Requirements](https://github.com/magiclabs/alchemy/wiki/Software-Requirements))

Expand All @@ -68,50 +55,53 @@ Installation

Use the installer (recommended):

gem install alchemy_cms --pre
gem install alchemy_cms
alchemy new my_magicpage

Start the local server:

rails server

Then just switch to your browser and open `http://localhost:3000`.
Then just switch to your browser and open `http://localhost:3000`

Add to existing Rails project
-----------------------------

Add to existing Rails project:
In your Gemfile:

add gem 'alchemy_cms' to Gemfile
gem 'alchemy_cms'

Run in terminal:

bundle install
rake alchemy:prepare
rake alchemy:standard_set:install (optional)
rake db:migrate
rake db:seed


Tipps
-----

1. This task creates all necessary folders and files needed for creating your own pagelayouts and elements for your website
1. This generator creates all necessary folders and files needed for creating your own page layouts and elements for your website:

rake generate alchemy:scaffold:all
rails generate alchemy:scaffold

2. If you use the ferret full text search (enabled by default), then please add a job to your crontab that reindexes the ferret index.

cd /path/to/your/alchemy && RAILS_ENV=production rake ferret:rebuild_index > /dev/null

3. You can easily create your element-files (for view and editor) depending on the `elements.yml` with this generator
3. You can easily create your element files (for view and editor) depending on the `elements.yml` with this generator:

rails generate elements

Resources
---------

* Homepage: <http://alchemy-app.com>
* Live-Demo: <http://demo.alchemy-app.com>
* Wiki: <http://wiki.alchemy-app.com>
* API Documentation: <http://api.alchemy-app.com>
* Issue-Tracker: <http://issues.alchemy-app.com>
* Sourcecode: <http://source.alchemy-app.com>
* Homepage: <http://alchemy-cms.com>
* Live-Demo: <http://demo.alchemy-cms.com>
* Wiki: <http://wiki.alchemy-cms.com>
* API Documentation: <http://api.alchemy-cms.com>
* Issue-Tracker: <http://issues.alchemy-cms.com>
* Sourcecode: <http://source.alchemy-cms.com>
* User Group: <http://groups.google.com/group/alchemy-cms>

Authors
Expand All @@ -124,4 +114,4 @@ Authors
License
-------

* GPLv3: <http://www.gnu.org/licenses/gpl.html/>
* BSD: <https://raw.github.com/magiclabs/alchemy_cms/master/LICENSE>
1 change: 0 additions & 1 deletion TODO.txt

This file was deleted.

2 changes: 1 addition & 1 deletion alchemy_cms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Gem::Specification.new do |s|
s.summary = %q{An extremly flexbile CMS for Rails 3.}
s.description = %q{Alchemy is an awesome Rails CMS with an extremely flexible content storing architecture.}
s.requirements << 'ImageMagick (libmagick), v6.6 or greater.'
s.license = 'GPL-3'
s.license = 'BSD New'

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/contents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def create

def update
content = Content.find(params[:id])
content.content.update_attributes(params[:content])
content.essence.update_attributes(params[:content])
render :update do |page|
page << "Alchemy.closeCurrentWindow();Alchemy.reloadPreview()"
end
Expand Down
16 changes: 8 additions & 8 deletions app/controllers/admin/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ def configure
end
end

def update
# fetching page via before filter
if @page.update_attributes(params[:page])
@notice = _("Page %{name} saved") % {:name => @page.name}
else
render_remote_errors(@page, "form#edit_page_#{@page.id} button.button")
end
end
def update
# fetching page via before filter
if @page.update_attributes(params[:page])
@notice = _("Page %{name} saved") % {:name => @page.name}
else
render_remote_errors(@page, "form#edit_page_#{@page.id} button.button")
end
end

def destroy
# fetching page via before filter
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/admin/trash_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ class Admin::TrashController < AlchemyController

before_filter :set_translation

helper Admin::ElementsHelper

def index
@elements = Element.trashed
@page = Page.find_by_id(params[:page_id])
@allowed_elements = Element.all_for_page(@page)
render :layout => false
rescue Exception => e
exception_handler(e)
end

def clear
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/alchemy_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def is_admin?
current_user.admin?
end

def render_errors_or_redirect(object, redicrect_url, flash_notice, button = nil)
def render_errors_or_redirect(object, redirect_url, flash_notice, button = nil)
if object.errors.empty?
flash[:notice] = _(flash_notice)
render(:update) { |page| page.redirect_to(redicrect_url) }
render(:update) { |page| page.redirect_to(redirect_url) }
else
render_remote_errors(object, button)
end
Expand All @@ -34,7 +34,7 @@ def render_remote_errors(object, button = nil)
render :update do |page|
page << "jQuery('#errors').html('<ul>" + object.errors.sum { |a, b| "<li>" + _(b) + "</li>" } + "</ul>')"
page << "jQuery('#errors').show()"
page << "Alchemy.enableButton('#{button}')" unless button.blank?
page << "Alchemy.enableButton('#{button || 'form button.button'}')"
end
end

Expand Down
43 changes: 27 additions & 16 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ class PagesController < AlchemyController

caches_action(
:show,
:layout => false,
:cache_path => Proc.new { |c| c.multi_language? ? "#{session[:language_code]}/#{c.params[:urlname]}" : "#{c.params[:urlname]}" },
:if => Proc.new { |c|
:cache_path => proc { url_for(:action => :show, :urlname => params[:urlname], :lang => multi_language? ? params[:lang] : nil) },
:if => proc do
if Alchemy::Config.get(:cache_pages)
page = Page.find_by_urlname_and_language_id_and_public(
c.params[:urlname],
params[:urlname],
session[:language_id],
true,
:select => 'page_layout, language_id, urlname'
Expand All @@ -24,20 +23,31 @@ class PagesController < AlchemyController
else
false
end
}
end
)

# Showing page from params[:urlname]
# @page is fetched via before filter
# @root_page is fetched via before filter
# @language fetched via before_filter in alchemy_controller
# rendering page and querying for search results if any query is present
def show
if configuration(:ferret) && !params[:query].blank?
perform_search
end
render :layout => params[:layout].blank? ? 'pages' : params[:layout] == 'none' ? false : params[:layout]
end
# Showing page from params[:urlname]
# @page is fetched via before filter
# @root_page is fetched via before filter
# @language fetched via before_filter in alchemy_controller
# rendering page and querying for search results if any query is present
def show
if configuration(:ferret) && !params[:query].blank?
perform_search
end
respond_to do |format|
format.html {
render :layout => params[:layout].blank? ? 'pages' : params[:layout] == 'none' ? false : params[:layout]
}
format.rss {
if @page.contains_feed?
render :action => "show.rss.builder", :layout => false
else
render :xml => { :error => 'Not found' }, :status => 404
end
}
end
end

# Renders a Google conform sitemap in xml
def sitemap
Expand Down Expand Up @@ -97,6 +107,7 @@ def perform_search
{:limit => :all},
{:conditions => ["public = ?", true]}
)
@search_results = (@text_search_results + @rtf_search_results).sort{ |y, x| x.ferret_score <=> y.ferret_score }
end

def find_first_public(page)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/elements_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def render_elements(options = {})
element_string = ""
if options[:fallback]
unless all_elements.detect { |e| e.name == options[:fallback][:for] }
if from = Page.find_by_page_layout(options[:fallback][:from])
if from = Page.find_by_page_layout_and_language_id(options[:fallback][:from], session[:language_id])
all_elements += from.elements.find_all_by_name(options[:fallback][:with].blank? ? options[:fallback][:for] : options[:fallback][:with])
end
end
Expand Down
44 changes: 39 additions & 5 deletions app/models/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ def store_page(page)

# nullifies the page_id aka. trashs it.
def trash
self.page_id = nil
self.folded = true
self.save(false)
self.update_attributes({
:page_id => nil,
:folded => true,
:public => false
})
end

def trashed?
Expand All @@ -77,9 +79,39 @@ def all_contents_by_type(essence_type)
self.contents.find_all_by_essence_type(essence_type)
end

# Returns the content that is marked as rss title.
#
# Mark a content as rss title in your +elements.yml+ file:
#
# - name: news
# contents:
# - name: headline
# type: EssenceText
# rss_title: true
#
def content_for_rss_title
rss_title = content_descriptions.detect { |c| c['rss_title'] }
contents.find_by_name(rss_title['name'])
end

# Returns the content that is marked as rss description.
#
# Mark a content as rss description in your +elements.yml+ file:
#
# - name: news
# contents:
# - name: body
# type: EssenceRichtext
# rss_description: true
#
def content_for_rss_description
rss_title = content_descriptions.detect { |c| c['rss_description'] }
contents.find_by_name(rss_title['name'])
end

# Inits a new element for page as described in /config/alchemy/elements.yml from element_name
def self.new_from_scratch(attributes)
attributes.stringify_keys!
attributes.stringify_keys!
return Element.new if attributes['name'].blank?
element_descriptions = Element.descriptions
return if element_descriptions.blank?
Expand Down Expand Up @@ -162,8 +194,9 @@ def available_content_description_for(content_name)

# returns the description of the element with my name in element.yml
def description
Element.descriptions.detect{ |d| d['name'] == self.name }
self.class.descriptions.detect{ |d| d['name'] == self.name }
end
alias_method :definition, :description

# Human name for displaying in selectboxes and element editor views.
# The name is beeing translated from elements name value as described in config/alchemy/elements.yml
Expand Down Expand Up @@ -379,6 +412,7 @@ def belonging_cellname

# List all elements for page_layout
def self.all_for_page(page)
raise TypeError if page.class != Page
# if page_layout has cells, collect elements from cells and group them by cellname
page_layout = Alchemy::PageLayout.get(page.page_layout)
if page_layout.blank?
Expand Down
12 changes: 12 additions & 0 deletions app/models/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ def find_elements(options = {}, show_non_public = false) #:nodoc:
all_elements
end

# Returns all elements that should be feeded via rss.
#
# Define feedable elements in your +page_layouts.yml+:
#
# - name: news
# feed: true
# feed_elements: [element_name, element_2_name]
#
def feed_elements
elements.find_all_by_name(definition['feed_elements'])
end

def elements_grouped_by_cells
group = ActiveSupport::OrderedHash.new
cells.each { |cell| group[cell] = cell.elements }
Expand Down
Loading

0 comments on commit 43f26df

Please sign in to comment.