diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 04ed6ad..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.DS_Store -*/.DS_Store \ No newline at end of file diff --git a/MIT-LICENSE b/MIT-LICENSE deleted file mode 100644 index 9376605..0000000 --- a/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009 [name of plugin creator] - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 717a717..fc22c66 100644 --- a/README.md +++ b/README.md @@ -1,88 +1,9 @@ -VRAME -===== +# Vrame and the NineAuthEngine have moved -VRAME is a CMS (content management system) based on Ruby on Rails. -It is designed to run as a Rails Engine on top of your existing Rails app. +Please update your submodule URLs to -Philosophy -========== + git://github.com/9elements/vrame.git + git://github.com/9elements/nine_auth_engine.git -VRAME does not force you into any kind of predefined, inappropriate structure. -It allows you to build and use your own information architecture. - -In order to integrate VRAME with your app, it provides a few Rails models which fulfill certain tasks: - -* Categories act like folders. They include schemas for their documents. -* Documents act as endpoints. They can be represented as a custom HTML template or as JSON for external APIs. -* Assets act as storage for files, mainly images. They care about thumbnail creation, video conversion, etc. -* Collections act as containers for multiple assets. - -Feature Overview ----------------- - -* Schema Builder: Create a schema for underlying documents -* Rich types for appropriate information representation - * Google Maps integration - * Images & thumbnail creation - * Video conversion -* User management _(in progress)_ - -Installation -============ - -The following versions are required for VRAME: - -* Rails >= 2.3.4 -* Ruby >= 1.8.6 -* MySQL >= 5.x - -Adding VRAME to your Rails App ------------------------------- - -Currently VRAME is only available from the official github repository. -The standard approach is to add VRAME and Nine Auth Engine as git submodules: - - cd your_rails_app - git submodule add git://github.com/sebastiandeutsch/vrame.git vendor/plugins/vrame - git submodule add git://github.com/sebastiandeutsch/nine_auth_engine.git vendor/plugins/nine_auth_engine - -There are plans to release VRAME as a gem when it has reachd a stable, more refined state. - -Initialize VRAME ----------------- - - sudo rake gems:install - rake vrame:bootstrap - -Dependencies ------------- - -For those where rake gems:install does not work try adding these dependencies to your environment.rb - - config.gem 'coupa-acts_as_tree', - :lib => 'coupa-acts_as_tree', - :source => 'http://gems.github.com' - - config.gem 'binarylogic-authlogic', - :lib => 'authlogic', - :source => 'http://gems.github.com' - - config.gem 'mislav-will_paginate', - :lib => 'will_paginate', - :source => 'http://gems.github.com' - - config.gem 'mini_magick', - :lib => 'mini_magick' - - config.gem 'thoughtbot-paperclip', - :lib => 'paperclip', - :source => 'http://gems.github.com', - :version => '~>2.3.1' - - config.gem 'norman-friendly_id', - :lib => 'friendly_id', - :source => 'http://gems.github.com' - - config.gem 'daemons' - -Copyright (c) 2009 9elements.com, released under the MIT license +This repository will be kept available for a while but development will take +place in the 9elements repositories. \ No newline at end of file diff --git a/Rakefile b/Rakefile deleted file mode 100644 index ff21b27..0000000 --- a/Rakefile +++ /dev/null @@ -1,23 +0,0 @@ -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -desc 'Default: run unit tests.' -task :default => :test - -desc 'Test the vrame plugin.' -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.libs << 'test' - t.pattern = 'test/**/*_test.rb' - t.verbose = true -end - -desc 'Generate documentation for the vrame plugin.' -Rake::RDocTask.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'Vrame' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('lib/**/*.rb') -end diff --git a/TODOS b/TODOS deleted file mode 100644 index 981a5e1..0000000 --- a/TODOS +++ /dev/null @@ -1,54 +0,0 @@ -TODO -============================================================================== - -Flexitypes ----------- - -- Posterframe - - Editieren vom File in neuem Fenster - - "Zurück" in Assets sollte richtig zurück, nicht zur Asset-Liste, sondern - zum Dokument - -- Store cleanup - - Auomatically remove values for keys not in schema when saving - - Provide function to convert from one schema to the other (using the slugs for mapping) -- Security for uploading assets -- Ensure the proper transmission of styles for assets - - Sane behavior in case of error -- Ensure pics with custom styles are delivered -- Make it so that pics with custom styles are deleted upon destroy. - Either - - Store all styles in the asset - - Store path to schema field in the asset - - Perform wildcard deletion -- SWFUpload File Size limit aufheben oder im flexitype speichern - -- Spec InvalidSchemaPathError -- Schema update constantize security check -- Purge unused values from document when deleting fields from the schema -- Asset/Collection Refactoring - - Remove AR associations - - Remove the Collection AR Model, do it all in JSON -- provide #human_name for JsonObject::Type and subclasses -- Utilize JsonObject::Store validations in Document validation and the - document form -- Utilize JsonObject::Schema validations in Categorys validation and the - document form -- Document all classes, methods and modules (doc) - with example on how to use them -- Field_by_uid rename to field_for_uid -- Ordering of the types in the category editor -- Put default file styles in the form, so they're not duplicated -- Complete the specs (check for coverage, implement pending) - - How can custom types override type behavior - -I18n ------------------------------------------------------------------------------- -- Migrate JsonObject strings to I18n - -Fixes ------------------------------------------------------------------------------- -- Breadcrumbs belong in a helper, not in the controller -- bg_thumb style is project specific, remove it from vrame -- When moving categories to another super-category, recalculate all positions - within the super-category \ No newline at end of file diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb deleted file mode 100644 index 041f51b..0000000 --- a/app/controllers/assets_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -class AssetsController < ApplicationController - - def download - @asset = Asset.find(params[:id]) - - @path = @asset.file.path.gsub(File.join(RAILS_ROOT, 'public'), '') - - head :x_accel_redirect => @path, - :content_type => @asset.file.content_type, - :content_disposition => "attachment; filename=#{@asset.file_file_name}" - end - -end \ No newline at end of file diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb deleted file mode 100644 index bc0ef34..0000000 --- a/app/controllers/categories_controller.rb +++ /dev/null @@ -1,72 +0,0 @@ -class CategoriesController < ApplicationController - def index - if params[:category_id] - # Show subcategories from given category - - @category = Category.by_language(current_language).published.find(params[:category_id]) - - # Filter confidential and unwanted attributes - @public_categories = @category.children.published.map(&:to_public_hash) - - respond_to do |format| - format.json do - response.headers["Content-Type"] = "text/plain; charset=utf-8" - render :json => @public_categories - end - format.xml do - render :xml => @public_categories - end - end - - else - # Don't show all categories - render :text => nil - end - end - - def show - begin - @category = Category.by_language(current_language).published.find(params[:id]) - rescue ActiveRecord::RecordNotFound - raise ActiveRecord::RecordNotFound, "Couldn't find Category with ID=#{params[:id]}, maybe you need to publish it first" - end - - # Redirect permanently to the most recent slug if given slug is outdated - if @category.found_using_outdated_friendly_id? - redirect_to @category, :status => 301 - return - end - - # If category has no documents, redirect to first child category with documents - if @category.insignificant? and not @category.children.empty? - @significant_category = @category.first_significant_child - redirect_to @significant_category.url.empty? ? @significant_category : "/#{@significant_category.url}" - return - end - - # Filter confidential and unwanted attributes - @public_category = @category.to_public_hash - - respond_to do |format| - format.html do - @documents = @category.documents.published - @page_title = @category.title - unless @category.template.blank? - if @category.layout.blank? - render :template => @category.template - else - render :template => @category.template, :layout => @category.layout - end - end - end - format.json do - render :json => @public_category - response.headers["Content-Type"] = "text/plain; charset=utf-8" - end - format.xml do - render :xml => @public_category - end - end - - end -end \ No newline at end of file diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb deleted file mode 100644 index 0d917c8..0000000 --- a/app/controllers/documents_controller.rb +++ /dev/null @@ -1,59 +0,0 @@ -class DocumentsController < ApplicationController - - def index - if params[:category_id] - # Show documents from given category - - @category = Category.by_language(current_language).published.find(params[:category_id]) - @documents = @category.documents.published - - # Emit documents with JSON store data mixed in - @public_documents = @documents.map(&:to_public_hash) - - respond_to do |format| - format.json do - response.headers["Content-Type"] = "text/plain; charset=utf-8" - render :json => @public_documents - end - format.xml do - render :xml => @public_documents - end - end - - else - # Don't show all documents - render :text => nil - end - end - - def show - - begin - @document = Document.by_language(current_language).published.find(params[:id]) - rescue ActiveRecord::RecordNotFound - raise ActiveRecord::RecordNotFound, "Couldn't find Document with ID=#{params[:id]}, maybe you need to publish it first" - end - - redirect_to @document, :status => 301 if @document.found_using_outdated_friendly_id? - - # Emit document with JSON store data mixed in - @public_document = @document.to_public_hash - - respond_to do |format| - format.html do - @page_title = @document.title - render(@document.render_options.blank? ? nil : @document.render_options) - end - format.json do - render :json => @public_document - end - format.xml do - render :xml => @public_document - end - end - end - - def search - @documents = Document.search(params[:q], language => current_language, :page => params[:page], :per_page => 10) - end -end \ No newline at end of file diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb deleted file mode 100644 index e25f31d..0000000 --- a/app/controllers/subscriptions_controller.rb +++ /dev/null @@ -1,30 +0,0 @@ -class SubscriptionsController < ApplicationController - def create - @subscription = Subscription.create(params[:subscription]) - - if @subscription.save - flash[:success] = 'Newsletter-Abonnement: Bestätigungsmail wurde versandt' - #redirect_to :root_path - else - flash[:error] = 'Newsletter-Abonnement konnte nicht angelegt werden' - redirect_to :back - end - end - - def confirm - @subscription = Subscription.find_by_token(params[:id]) - @subscription.confirm! - flash[:success] = 'Newsletter-Abonnement wurde erfolgreich hinzugefügt!' - redirect_to root_path - end - - def unsubscribe - @subscription = Subscription.find_by_token(params[:id]) - if @subscription.destroy - flash[:success] = 'Adresse erfolgreich von Empfängerliste entfernt!' - else - flash[:error] = 'Adresse konnte nicht gelöscht werden!' - end - redirect_to root_path - end -end \ No newline at end of file diff --git a/app/controllers/vrame/assets_controller.rb b/app/controllers/vrame/assets_controller.rb deleted file mode 100644 index b42a688..0000000 --- a/app/controllers/vrame/assets_controller.rb +++ /dev/null @@ -1,110 +0,0 @@ -require 'paperclip_filetypes' - -class Vrame::AssetsController < Vrame::VrameController - - skip_before_filter :verify_authenticity_token, :only => :create - skip_before_filter :require_user, :only => :create - - def index - per_page = params[:per_page] || 50 - @assets = Asset.paginate :page => params[:page], :per_page => per_page - end - - def show - @asset = Asset.find(params[:id]) - if @asset.assetable - redirect_to [:edit, :vrame, @asset.assetable] - else - flash[:error] = 'Zugehörigkeit des Assets nicht gefunden' - redirect_to :back - end - end - - # no new action - - def create - params[:file] = params.delete(:Filedata) - params[:user] = @current_user - - # Get Paperclip styles if schema given - params[:vrame_styles] = JsonObject::Types::Asset.styles_for(params[:schema]) if params[:schema] - - @asset = Asset.factory(params) - - # Build response hash - response = { :id => @asset.id } - - parent_type = params[:parent_type] - parent_id = params[:parent_id] - - # Set up assetable relation - if params[:upload_type] == "collection" - # The asset belongs to a collection - @collection = @asset.initialize_collection(params[:collection_id], parent_type, parent_id) - - # Add collection id to the response - response[:collection_id] = @collection.id - else - # The asset belongs directly to an object (e.g. Document) - @asset.assetable_id = parent_id - @asset.assetable_type = parent_type - @asset.save - end - - # Render HTML for asset list item - response[:asset_list_item] = render_to_string(:partial => 'vrame/shared/asset_list_item', :locals => { :asset => @asset }) - - # Send JSON response - render :json => response - end - - def edit - @asset = Asset.find(params[:id]) - end - - def update - @asset = Asset.find(params[:id]) - params[:asset][:user_id] = @current_user.id - - if @asset.update_attributes(params[:asset]) - if request.xhr? - render :text => 'OK' - else - flash[:success] = 'Asset aktualisiert' - redirect_to :back - end - else - if request.xhr? - render :text => 'Error' - else - flash[:error] = 'Fehler beim Löschen des Assets' - redirect_to :back - end - end - end - - def destroy - @asset = Asset.find(params[:id]) - - if @asset and @asset.destroy - if request.xhr? - render :text => 'OK' - else - flash[:success] = 'Asset gelöscht' - redirect_to :back - end - else - if request.xhr? - render :text => 'Error' - else - flash[:error] = 'Fehler beim Löschen des Assets' - redirect_to :back - end - end - end - - private - def single_access_allowed? - action_name == 'create' - end -end \ No newline at end of file diff --git a/app/controllers/vrame/categories_controller.rb b/app/controllers/vrame/categories_controller.rb deleted file mode 100644 index eac6171..0000000 --- a/app/controllers/vrame/categories_controller.rb +++ /dev/null @@ -1,130 +0,0 @@ -class Vrame::CategoriesController < Vrame::VrameController - - def index - @categories = Category.by_language(current_language).roots - - if params[:category_id] - @active_category = Category.by_language(current_language).find(params[:category_id]) - @documents = @active_category.documents - else - if session["vrame_backend_#{current_language.id}_category_id"] - begin - @active_category = Category.by_language(current_language).find(session["vrame_backend_#{current_language.id}_category_id"]) - @documents = @active_category.documents - rescue - session["vrame_backend_#{current_language.id}_category_id"] = nil - @active_category = nil - @documents = [] - end - else - if @categories.first - @active_category = @categories.first - @documents = @active_category.documents - else - @active_category = nil - @documents = [] - end - end - end - end - - def sort - @category = Category.by_language(current_language).find(params[:id]) - - params[:document].each_with_index do |id, i| - document = Document.find_by_id(id) - if document.category_id == @category.id - document.position = i - document.save - end - end - - render :text => 'ok' - end - - def new - @category = current_language.categories.build - if params[:category_id] - @category.parent = Category.by_language(current_language).find(params[:category_id]) - end - - @breadcrumbs = [{ :title => 'Kategorien', :url => vrame_categories_path }] - @category.ancestors.reverse.each { |a| @breadcrumbs << { :title => a.title, :url => vrame_category_path(a) } } - end - - def create - @category = Category.new(params[:category]) - - if @category.save - flash[:success] = 'Kategorie angelegt' - redirect_to vrame_categories_path + "#category-#{@category.to_param}" - else - flash[:error] = 'Dokument konnte nicht angelegt werden' - @breadcrumbs = [{ :title => 'Kategorien', :url => vrame_categories_path }] - render :action => :new - end - end - - def edit - @category = Category.by_language(current_language).find(params[:id]) - end - - def edit_eigenschema - @category = Category.by_language(current_language).find(params[:id]) - end - - def edit_eigenvalues - @category = Category.by_language(current_language).find(params[:id]) - end - - def update - @category = Category.by_language(current_language).find(params[:id]) - - if @category.update_attributes(params[:category]) - flash[:success] = 'Die Kategorie wurde aktualisiert' - redirect_to vrame_categories_path + "#category-#{@category.to_param}" - else - flash[:error] = 'Es ist ein Fehler aufgetreten' - render :action => :edit - end - end - - def destroy - @category = Category.by_language(current_language).find(params[:id]) - if @category.destroy - flash[:success] = 'Die Kategorie wurde gelöscht' - redirect_to vrame_categories_path + (@category.parent ? "#category-#{@category.parent.to_param}" : "") - else - flash[:error] = 'Die Kategorie konnte nicht gelöscht werden' #TODO Error Messages hierhin - redirect_to vrame_categories_path + "#category-#{@category.to_param}" - end - end - - def order_up - @category = Category.by_language(current_language).find(params[:id]) - @category.move_higher - - redirect_to vrame_categories_path + "#category-#{@category.to_param}" - end - - def order_down - @category = Category.by_language(current_language).find(params[:id]) - @category.move_lower - - redirect_to vrame_categories_path + "#category-#{@category.to_param}" - end - - def publish - @category = Category.by_language(current_language).find(params[:id]) - @category.publish - - redirect_to vrame_categories_path + "#category-#{@category.to_param}" - end - - def unpublish - @category = Category.by_language(current_language).find(params[:id]) - @category.unpublish - - redirect_to vrame_categories_path + "#category-#{@category.to_param}" - end -end \ No newline at end of file diff --git a/app/controllers/vrame/collections_controller.rb b/app/controllers/vrame/collections_controller.rb deleted file mode 100644 index 83189be..0000000 --- a/app/controllers/vrame/collections_controller.rb +++ /dev/null @@ -1,52 +0,0 @@ -class Vrame::CollectionsController < Vrame::VrameController - - def index - per_page = params[:per_page] || 50 - @collections = Collection.paginate :page => params[:page], :per_page => per_page - end - - def show - @collection = Collection.find(params[:id]) - if @collection.collectionable - redirect_to [:edit, :vrame, @collection.collectionable] - else - flash[:error] = 'Zugehörigkeit der Collection nicht gefunden' - redirect_to :back - end - end - - def rearrange - @collection = Collection.find(params[:id]) - end - - def sort - @collection = Collection.find(params[:id]) - - params[:asset].each_with_index do |id, i| - asset = Asset.find_by_id(id, @collection.id) - - # sanity check - if asset.assetable_id == @collection.id - asset.position = i - asset.save - end - end - - render :text => 'ok' - end - - def destroy - @collection = Collection.find(params[:id]) - if @collection and @collection.destroy - flash[:success] = 'Collection gelöscht' - else - flash[:error] = 'Fehler beim Löschen der Collection' - end - redirect_to :root - end - - private - def single_access_allowed? - action_name == 'create' - end -end \ No newline at end of file diff --git a/app/controllers/vrame/documents_controller.rb b/app/controllers/vrame/documents_controller.rb deleted file mode 100644 index 3e80cf6..0000000 --- a/app/controllers/vrame/documents_controller.rb +++ /dev/null @@ -1,95 +0,0 @@ -class Vrame::DocumentsController < Vrame::VrameController - - def index - session["vrame_backend_#{current_language.id}_category_id"] = params[:category_id] - - @category = Category.find(params[:category_id]) - @documents = @category.documents - - render :partial => 'vrame/categories/documents', :locals => { :documents => @documents, :category => @category } - end - - def new - @category = Category.by_language(current_language).find(params[:category_id]) - - @document = @category.documents.build(:language_id => current_language.id) - - @breadcrumbs = [{ :title => 'Kategorien', :url => vrame_categories_path }] # @TODO This belongs in a helper - @category.ancestors.reverse.push(@category).each { |a| @breadcrumbs << { :title => a.title, :url => vrame_category_path(a) } } - end - - def create - @category = Category.find(params[:category_id]) - - @document = Document.new(params[:document].merge({ :category => @category })) - - if @document.save - flash[:success] = 'Dokument angelegt' - redirect_to vrame_categories_path + "#document-#{@document.to_param}" - else - flash[:error] = 'Dokument konnte nicht angelegt werden' - @breadcrumbs = [{ :title => 'Kategorien', :url => vrame_categories_path }] - render :action => :new - end - end - - def edit - @document = Document.find(params[:id]) - @category = @document.category - - @collections = Hash.new # { |hash, key| hash[key] = @document.collections.build } - @document.collections.each { |c| @collections[c.id] = c } - end - - def update - @document = Document.find(params[:id]) - - if @document.update_attributes(params[:document]) - flash[:success] = 'Dokument aktualisiert' - redirect_to vrame_categories_path + "#document-#{@document.to_param}" - else - flash[:error] = 'Es ist ein Fehler aufgetreten' - render :action => :edit - end - end - - def destroy - @document = Document.find(params[:id]) - @category = @document.category - if @document.destroy - flash[:success] = 'Das Dokument wurde gelöscht' - redirect_to vrame_categories_path + "#category-#{@category.to_param}" - else - flash[:error] = 'Das Dokument konnte nicht gelöscht werden' #TODO Error Messages hierhin - redirect_to vrame_categories_path - end - end - - def order_up - @document = Document.find(params[:id]) - @document.move_higher - - redirect_to vrame_categories_path + "#document-#{@document.to_param}" - end - - def order_down - @document = Document.find(params[:id]) - @document.move_lower - - redirect_to vrame_categories_path + "#document-#{@document.to_param}" - end - - def publish - @document = Document.find(params[:id]) - @document.publish - - redirect_to vrame_categories_path + "#document-#{@document.to_param}" - end - - def unpublish - @document = Document.find(params[:id]) - @document.unpublish - - redirect_to vrame_categories_path + "#document-#{@document.to_param}" - end -end \ No newline at end of file diff --git a/app/controllers/vrame/languages_controller.rb b/app/controllers/vrame/languages_controller.rb deleted file mode 100644 index 1ed8a5a..0000000 --- a/app/controllers/vrame/languages_controller.rb +++ /dev/null @@ -1,43 +0,0 @@ -class Vrame::LanguagesController < Vrame::VrameController - def index - per_page = params[:per_page] || 50 - - @languages = Language.paginate :page => params[:page], :per_page => per_page - end - - def edit - @language = Language.find(params[:id]) - end - - def update - @language = Language.find(params[:id]) - if @language.update_attributes params[:language] - flash[:success] = 'Sprache aktualisiert' - redirect_to :action => :index - else - flash[:error] = 'Es ist ein Fehler aufgetreten' - render :action => :edit - end - end - - def create - @language = Language.new(params[:language]) - if @language.save - flash[:success] = 'Sprache angelegt' - redirect_to :action => :index - else - flash[:error] = 'Es sind Fehler aufgetreten' - redirect_to :action => :index - end - end - - def destroy - @language = Language.find(params[:id]) - if @language.destroy - flash[:success] = 'Die Sprache wurde gelöscht' - else - flash[:error] = 'Die Sprache konnte nicht gelöscht werden' #TODO Error Messages hierhin - end - redirect_to :action => :index - end -end \ No newline at end of file diff --git a/app/controllers/vrame/mailer/newsletters_controller.rb b/app/controllers/vrame/mailer/newsletters_controller.rb deleted file mode 100644 index dd06091..0000000 --- a/app/controllers/vrame/mailer/newsletters_controller.rb +++ /dev/null @@ -1,68 +0,0 @@ -class Vrame::Mailer::NewslettersController < Vrame::VrameController - def index - per_page = params[:per_page] || 50 - - @newsletters = Newsletter.paginate :page => params[:page], :per_page => per_page, :order => :created_at - end - - def destroy - @newsletter = Newsletter.find(params[:id]) - if @newsletter.destroy - flash[:success] = 'Newsletter wurde gelöscht' - else - flash[:error] = 'Newsletter konnte nicht gelöscht werden' - end - redirect_to :action => :index - end - - def new - @newsletter = Newsletter.new - end - - def create - @newsletter = Newsletter.new(params[:newsletter]) - - if @newsletter.save - flash[:success] = 'Newsletter angelegt' - redirect_to :action => :index - else - flash[:error] = 'Newsletter konnte nicht angelegt werden' - render :new - end - end - - def edit - @newsletter = Newsletter.find(params[:id]) - end - - def update - @newsletter = Newsletter.find(params[:id]) - - if @newsletter.update_attributes(params[:newsletter]) - flash[:success] = 'Newsletter aktualisiert' - redirect_to vrame_mailer_newsletters_path - else - flash[:error] = 'Es ist ein Fehler aufgetreten' - render :action => :edit - end - end - - def preview - @recipient = current_user.email - - @newsletter = Newsletter.find(params[:id]) - @newsletter.send_preview_to(current_user) - flash[:success] = "Newsletter \"#{@newsletter.title}\" wurde an #{@recipient} versandt!" - - redirect_to vrame_mailer_newsletters_path - end - - def schedule - @newsletter = Newsletter.find(params[:id]) - @newsletter.schedule_now! - - flash[:success] = "Newsletter \"#{@newsletter.title}\" wurde an alle Abonnenten versandt!" - - redirect_to vrame_mailer_newsletters_path - end -end \ No newline at end of file diff --git a/app/controllers/vrame/mailer/subscriptions_controller.rb b/app/controllers/vrame/mailer/subscriptions_controller.rb deleted file mode 100644 index ad8c69c..0000000 --- a/app/controllers/vrame/mailer/subscriptions_controller.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Vrame::Mailer::SubscriptionsController < Vrame::VrameController - def index - per_page = params[:per_page] || 50 - - @subscriptions = Subscription.paginate :page => params[:page], :per_page => per_page, :order => :email - end - - def destroy - @subscription = Subscription.find(params[:id]) - if @subscription.destroy - flash[:success] = 'Empfänger wurde gelöscht' - else - flash[:error] = 'Der Empfänger konnte nicht gelöscht werden' - end - redirect_to :action => :index - end -end \ No newline at end of file diff --git a/app/controllers/vrame/vrame_controller.rb b/app/controllers/vrame/vrame_controller.rb deleted file mode 100644 index ba27798..0000000 --- a/app/controllers/vrame/vrame_controller.rb +++ /dev/null @@ -1,26 +0,0 @@ -class Vrame::VrameController < ApplicationController - layout 'vrame' - - before_filter :require_user - - def switch_language - @current_language = Language.find(params[:id]) - session["vrame_backend_language_id"] = @current_language.id - - redirect_to vrame_root_path - end - -private - def select_language - if session["vrame_backend_language_id"] - @current_language = Language.find(session["vrame_backend_language_id"]) - else - @current_language = Language.all.first - end - - raise NoLanguageInDatabaseError, "You have to add a language to the database" if @current_language.nil? - session["vrame_backend_language_id"] = @current_language.id - - true - end -end \ No newline at end of file diff --git a/app/helpers/vrame_helper.rb b/app/helpers/vrame_helper.rb deleted file mode 100644 index 9c9d49b..0000000 --- a/app/helpers/vrame_helper.rb +++ /dev/null @@ -1,114 +0,0 @@ -module ActionView - module Helpers - - class FormBuilder - def labelled_check_box(field_name, label) - label field_name, check_box(field_name) + ' ' + label.to_s - end - end - - def tree_select(object, method, collection, value_method, text_method, options = {}, html_options = {}) - options[:indent] = '  ' unless options[:indent] - InstanceTag.new(object, method, self, options.delete(:object)).to_tree_select_tag(collection, value_method, text_method, options, html_options) - end - - class InstanceTag #:nodoc: - def options_from_tree_recursion(collection, value_method, text_method, options, html_options, level = 0) - ret = '' - collection.each do |item| - ret += '' - end - ret - end # end def options_from_tree_recursion - - def to_tree_select_tag(collection, value_method, text_method, options, html_options) - html_options = html_options.stringify_keys - add_default_name_and_id(html_options) - value = value(object) - content_tag( - "select", add_options(options_from_tree_recursion(collection, value_method, text_method, options, html_options, 0), options, value), html_options - ) - end # end def to_tree_select_tag - end # end class InstanceTag - - end # end module Helpers -end # module ActionView - -module VrameHelper - def category_title(category) - if category.documents_count > 0 - "#{h(category.title)} (#{category.documents_count})" - else - "#{h(category.title)}" - end - end - - def tree_ul(acts_as_tree_set, init=true, &block) - if acts_as_tree_set.size > 0 - ret = '' - end - end - - def category_tree(acts_as_tree_set, level = 0, &block) - if acts_as_tree_set.size > 0 - concat('') - end - end - - def tooltip(title, body, options = {}) - options = { :class => 'smaller button invert tooltip', :title => body }.merge(options) - - link_to(title, '#', options) - end - - def type_select_tag(name, value = nil) - select_tag(name, options_for_select(Category::TYPES, value)) - end - - # Current controller and action as body classes, namespaced with vc/va - # - # vc_ for VrameController, va_ for VrameAction - def bodyclass - "vc_#{params[:controller].gsub("/", '_')} va_#{params[:action]}" - end -end diff --git a/app/models/asset.rb b/app/models/asset.rb deleted file mode 100644 index e6a80df..0000000 --- a/app/models/asset.rb +++ /dev/null @@ -1,69 +0,0 @@ -require 'paperclip_filetypes' - -class Asset < ActiveRecord::Base - acts_as_list :scope => :assetable - - belongs_to :user - belongs_to :assetable, :polymorphic => true - - attr_accessor :vrame_styles - - DEFAULT_STYLES = { - :vrame_backend => "100x50", - :thumbnail => "100x140", - :thumbnail_square => "100x100#", - :full => "300x250", - :bg_thumb => "392x272" - } - - has_attached_file :file, - :path => ":rails_root/public/system/assets/:class/:id/:style.:extension", - :url => "/system/assets/:class/:id/:style.:extension" - - has_attached_file :posterframe, - :path => ":rails_root/public/system/assets/:class/:id/posterframe_:style.:extension", - :url => "/system/assets/:class/:id/posterframe_:style.:extension", - :styles => lambda { |attachment| - returning(HashWithIndifferentAccess.new) do |styles| - styles.merge!(attachment.instance.vrame_styles) if attachment.instance.vrame_styles.is_a? Hash - styles.merge!(Vrame.configuration.posterframe_styles) if Vrame.configuration.posterframe_styles.is_a? Hash - styles.merge!(Asset::DEFAULT_STYLES) - end - } - - after_post_process :store_posterframe_dimensions - - def store_posterframe_dimensions - return unless self.posterframe? - dim = Paperclip::Geometry.from_file(self.posterframe.queued_for_write[:original].path) - self.posterframe_width = dim.width - self.posterframe_height = dim.height - end - - def serialize - file.url - end - - def self.factory(attributes) - file = attributes[:file] - filename = file.respond_to?(:original_filename) ? file.original_filename : file.basename - is_image = Paperclip::Attachment.is_image?(filename) - klass = is_image ? Image : Asset - klass.create(:file => file, :user => attributes[:user], :vrame_styles => attributes[:vrame_styles]) - end - - def initialize_collection(collection_id = nil, parent_type = nil, parent_id = nil) - @collection = Collection.find_or_create_by_id(collection_id) do |collection| - collection.user = self.user - if parent_id && parent_type - collection.collectionable_id = parent_id - collection.collectionable_type = parent_type - end - end - - @collection.assets << self - - @collection - end - -end \ No newline at end of file diff --git a/app/models/category.rb b/app/models/category.rb deleted file mode 100644 index 5492d42..0000000 --- a/app/models/category.rb +++ /dev/null @@ -1,90 +0,0 @@ -class Category < ActiveRecord::Base - TYPES = JsonObject::Types.constants.map {|x| "JsonObject::Types::" + x} - TYPES_FOR_SELECT = TYPES.map {|t| [t[/\w+$/], t]} - - has_many :documents, :order => :position - belongs_to :parent, - :class_name => 'Category' - belongs_to :language - has_many :collections, :dependent => :destroy, :as => :collectionable - has_many :assets, :order => "position", :dependent => :destroy, :as => :assetable - - has_friendly_id :title, :use_slug => true, :strip_diacritics => true - - belongs_to :user - - acts_as_tree :order => "position", :counter_cache => true - acts_as_list :scope => :parent - before_save :recalc_position_after_move - - validates_presence_of :title - - named_scope :order_before, lambda {|position| { :conditions => ["position < ?", position], :limit => 1, :order => "position DESC" }} - named_scope :order_after, lambda {|position| { :conditions => ["position > ?", position], :limit => 1, :order => "position ASC" }} - named_scope :by_position, { :order => 'position ASC' } - named_scope :with_parent, lambda {|parent| {:conditions => ["parent_id = ?", parent.id ]} } - named_scope :short_navigation, :conditions => { :short_navigation => 1 } - named_scope :published, :conditions => ['`categories`.`published` = ?', true] - named_scope :in_navigation, :conditions => '`categories`.`hide_in_nav` IS NULL OR `categories`.`hide_in_nav` != 1' - named_scope :by_language, lambda { |language| { :conditions => { :language_id => language.id } } } - - has_json_schema :schema - has_json_schema :eigenschema - has_json_store :meta, :schema => :eigenschema - - Public_attributes = %w(id title url meta_keywords meta_description meta_title parent_id language_id updated_at created_at) - - def backend_url_path - '/vrame/' + backend_url - end - - def frontend_path - if self.url.blank? - self - elsif self.url =~ /^\// - self.url - else - "/#{self.url}" - end - end - - def to_public_hash - - # Convert category to hash, only accept some attributes - category_hash = attributes.reject { |key, _| !Public_attributes.include?(key) } - - # Set url - category_hash['url'] = to_param if category_hash['url'].empty? - - category_hash - - end - - def insignificant? - documents.empty? and url.empty? and template.empty? - end - - def first_significant_child - children.find( - :first, - :order => :position, - :conditions => '`published` = 1 AND (`documents_count` > 0 OR `url` IS NOT NULL OR `template` IS NOT NULL)' - ) - end - - def publish - self.published = true - self.save - end - - def unpublish - self.published = false - self.save - end - -private - - def recalc_position_after_move - add_to_list_bottom if parent_id_changed? - end -end \ No newline at end of file diff --git a/app/models/collection.rb b/app/models/collection.rb deleted file mode 100644 index 373b2c4..0000000 --- a/app/models/collection.rb +++ /dev/null @@ -1,11 +0,0 @@ -class Collection < ActiveRecord::Base - - belongs_to :collectionable, :polymorphic => true - belongs_to :user - - has_many :assets, :order => "position", :dependent => :destroy, :as => :assetable - - def serialize - assets.map(&:serialize) - end -end \ No newline at end of file diff --git a/app/models/document.rb b/app/models/document.rb deleted file mode 100644 index 388c69c..0000000 --- a/app/models/document.rb +++ /dev/null @@ -1,95 +0,0 @@ -class Document < ActiveRecord::Base - - has_many :collections, :dependent => :destroy, :as => :collectionable - has_many :assets, :dependent => :destroy, :as => :assetable, :order => "position" - belongs_to :category, :counter_cache => true - belongs_to :user - - acts_as_list :scope => :category - - has_friendly_id :title, :use_slug => true, :strip_diacritics => true - - has_json_store :meta, :schema => [:category, :schema] - - - named_scope :order_before, lambda {|position| {:conditions => ["position < ?", position], :limit => 1, :order => "position DESC"}} - named_scope :order_after, lambda {|position| {:conditions => ["position > ?", position], :limit => 1, :order => "position ASC"}} - named_scope :with_parent, lambda {|category| - if category.category_id != nil - {:conditions => ["category_id = ?", category.category_id ]} - else - {:conditions => ["category_id IS NULL"]} - end - } - named_scope :published, :conditions => ['`documents`.`published` = ?', true] - named_scope :by_language, lambda { |language| { :conditions => { :language_id => language.id } } } - - validates_presence_of :title - - Public_attributes = %w(id title url meta_keywords meta_description meta_title category_id language_id updated_at created_at) - - def meta_hash - - meta_hash = {} - - if meta - meta.schema.fields.each do |field| - value = meta.send(field.name) - - # @TODO: Move into model - value = value.serialize if value.class.respond_to?(:serialize) - - meta_hash[field.name] = value - end - end - - meta_hash - - end - - def to_public_hash - - # Convert document to hash, only accept some attributes - document_hash = attributes.reject { |key, _| !Public_attributes.include?(key) } - - # Set url - document_hash['url'] = to_param if document_hash['url'].blank? - - # Mix in JSON store items - document_hash.merge!(meta_hash) - - end - - def self.search(keyword, options = { :page => 1, :per_page => 10, :language => nil }) - query_string = keyword.gsub(/\\/, '\&\&').gsub(/'/, "''").gsub('%', '\%').gsub('_', '\_') - - where = "(documents.title like '%#{query_string}%' - or documents.meta_json like '%#{query_string}%' - or documents.meta_title like '%#{query_string}%' - or documents.meta_keywords like '%#{query_string}%' - or documents.meta_description like '%#{query_string}%') - and searchable = 1" - where = "#{where} and document.language_id = #{language.id}" if not language.nil? - - sql = "select documents.* from documents where #{where}" - self.paginate_by_sql sql, options - end - - def publish - self.published = true - self.save - end - - def unpublish - self.published = false - self.save - end - - def render_options - returning(Hash.new) do |options| - options[:template] = self.template.blank? ? category.document_template : self.template - options[:layout] = self.layout.blank? ? category.document_layout : self.layout - options.delete_if {|key, value| value.blank?} - end - end -end \ No newline at end of file diff --git a/app/models/image.rb b/app/models/image.rb deleted file mode 100644 index 8bca8bc..0000000 --- a/app/models/image.rb +++ /dev/null @@ -1,25 +0,0 @@ -class Image < Asset - belongs_to :collection - - has_attached_file :file, - :path => ":rails_root/public/system/assets/:class/:id/:style.:extension", - :url => "/system/assets/:class/:id/:style.:extension", - :styles => lambda { |attachment| - returning(HashWithIndifferentAccess.new) do |styles| - styles.merge!(attachment.instance.vrame_styles) if attachment.instance.vrame_styles.is_a? Hash - styles.merge!(Vrame.configuration.image_styles) if Vrame.configuration.image_styles.is_a? Hash - styles.merge!(Asset::DEFAULT_STYLES) - end - }, - :convert_options => { :all => "-quality 80 -colorspace RGB -strip" } - - after_post_process :store_dimensions - - def store_dimensions - return unless self.file? - dim = Paperclip::Geometry.from_file(self.file.queued_for_write[:original].path) - self.file_width = dim.width - self.file_height = dim.height - end - -end \ No newline at end of file diff --git a/app/models/language.rb b/app/models/language.rb deleted file mode 100644 index dc692f5..0000000 --- a/app/models/language.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Language < ActiveRecord::Base - has_many :categories, :order => :position - has_many :documents, :order => :position - - validates_presence_of :name, :message => 'Das Feld darf nicht leer sein' - validates_presence_of :iso2_code, :message => 'Das Feld darf nicht leer sein' - - named_scope :published, { :conditions => ["published = ?", true] } -end \ No newline at end of file diff --git a/app/models/mailing.rb b/app/models/mailing.rb deleted file mode 100644 index 13954a3..0000000 --- a/app/models/mailing.rb +++ /dev/null @@ -1,24 +0,0 @@ -class Mailing < ActiveRecord::Base - belongs_to :newsletter - belongs_to :subscription - - validates_uniqueness_of :newsletter_id, :scope => :subscription_id - - named_scope :undelivered, :conditions => { :delivered => false } - - def deliver! - # Setting flag first to avoid multiple deliveries - self.delivered = true - save - - NewsletterMailer.deliver_newsletter(self.newsletter, self.subscription) - end - - def self.batch_process!(batch_size = 50) - mailings_batch = undelivered.scoped(:limit => batch_size) - - return if mailings_batch.empty? - - mailings_batch.each do |mailing| mailing.deliver! end - end -end \ No newline at end of file diff --git a/app/models/newsletter.rb b/app/models/newsletter.rb deleted file mode 100644 index c3cbc56..0000000 --- a/app/models/newsletter.rb +++ /dev/null @@ -1,81 +0,0 @@ -class Newsletter < ActiveRecord::Base - before_save :extract_body_plain_text - - has_many :subscriptions, :through => :mailings - has_many :mailings - - named_scope :due, :conditions => "dispatched=0 AND publish_on < NOW()" - - validates_presence_of :title, :body - - include ActionView::Helpers::SanitizeHelper - extend ActionView::Helpers::SanitizeHelper::ClassMethods - - def send_preview_to(recipient) - NewsletterMailer.deliver_newsletter(self, recipient) - end - - def schedule_now! - return if dispatched - - @subscriptions = Subscription.activated - - @subscriptions.each do |subscription| - Mailing.create(:newsletter => self, :subscription => subscription) - end - - self.dispatched = true - self.recipients = @subscriptions.size - - save - end - - def title_for(recipient) - personalize_for(recipient, title) - end - - def body_for(recipient) - personalize_for(recipient, body) - end - - def body_plain_text_for(recipient) - personalize_for(recipient, body_plain_text) - end - - ATTRIBUTE_PLACEHOLDERS = { - /\$ANREDE/ => :salutation, - /\$VORNAME/ => :first_name, - /\$NACHNAME/ => :last_name, - /\$ABMELDUNG_URL/ => :unsubscribe_url - } - - def personalize_for(recipient, text) - if recipient.class == Subscription - ATTRIBUTE_PLACEHOLDERS.each do |placeholder, attribute| - text.gsub!(placeholder, recipient.send(attribute)) - end - end - - return text - end - - HTML_REPLACEMENTS = { - # Line breaks - /
<\/?br><\/div>/ => "\n\n", - - # List elements - /
  • ([^<]*)<\/li>/ => "- \\1 \n" - } - - def extract_body_plain_text - self.body_plain_text = body - - # Replace HTML with suitable plaintext equivalents - HTML_REPLACEMENTS.each do |from, to| - self.body_plain_text.gsub!(from, to) - end - - # Strip remaining HTML tags - self.body_plain_text = strip_tags(body_plain_text) - end -end diff --git a/app/models/newsletter_mailer.rb b/app/models/newsletter_mailer.rb deleted file mode 100644 index a0e1e6c..0000000 --- a/app/models/newsletter_mailer.rb +++ /dev/null @@ -1,50 +0,0 @@ -class NewsletterMailer < ActionMailer::Base - def newsletter(newsletter, recipient) - recipients recipient.email - from "Aoste-Newsletter " - subject newsletter.title_for(recipient) - sent_on Time.now - content_type "multipart/alternative" - - part "text/plain" do |p| - p.body = newsletter.body_plain_text_for(recipient) - end - - part "text/html" do |p| - p.body = newsletter.body_for(recipient) - end - end - - def confirmation_request(recipient) - recipients recipient.email - from "Aoste Newsletter " - subject "Bestätigung des Aoste Newsletter-Abonnements" - sent_on Time.now - content_type "multipart/alternative" - - part :content_type => "text/plain", :body => render_message("confirmation_request.plain", :recipient => recipient) - part :content_type => "text/html", :body => render_message("confirmation_request.html", :recipient => recipient) - end - - def welcome_message(recipient) - recipients recipient.email - from "Aoste Newsletter " - subject "Aoste Newsletter-Abonnement bestätigt!" - sent_on Time.now - content_type "multipart/alternative" - - part :content_type => "text/plain", :body => render_message("welcome_message.plain", :recipient => recipient) - part :content_type => "text/html", :body => render_message("welcome_message.html", :recipient => recipient) - end - - def unsubscribe_message(recipient) - recipients recipient.email - from "Aoste Newsletter " - subject "Ihre E-Mail-Adresse wurde vom Aoste-Newsletter entfernt" - sent_on Time.now - content_type "multipart/alternative" - - part :content_type => "text/plain", :body => render_message("unsubscribe_message.plain", :recipient => recipient) - part :content_type => "text/html", :body => render_message("unsubscribe_message.html", :recipient => recipient) - end -end \ No newline at end of file diff --git a/app/models/schema_item.rb b/app/models/schema_item.rb deleted file mode 100644 index ba8cba5..0000000 --- a/app/models/schema_item.rb +++ /dev/null @@ -1,5 +0,0 @@ -class SchemaItem < HashWithIndifferentAccess # Hash - def method_missing(method_name, *args) - self[method_name.to_sym] - end -end \ No newline at end of file diff --git a/app/models/subscription.rb b/app/models/subscription.rb deleted file mode 100644 index 126ada5..0000000 --- a/app/models/subscription.rb +++ /dev/null @@ -1,44 +0,0 @@ -class Subscription < ActiveRecord::Base - has_many :newsletters, :through => :mailings - - before_create :generate_token - after_create :send_confirmation! - before_destroy :send_unsubscribe_message! - - validates_presence_of :email, :first_name, :last_name, :salutation - validates_uniqueness_of :email - validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :on => :create - - named_scope :activated, :conditions => { :active => true } - - def generate_token - self.token = rand(36**32).to_s(36) - end - - def send_confirmation! - NewsletterMailer.deliver_confirmation_request(self) - end - - def confirm! - self.active = true - save - - NewsletterMailer.deliver_welcome_message(self) - end - - def send_unsubscribe_message! - NewsletterMailer.deliver_unsubscribe_message(self) - end - - def confirm_url - "http://#{NineAuthEngine.configuration.host}/subscriptions/#{token}/confirm" - end - - def unsubscribe_url - "http://#{NineAuthEngine.configuration.host}/subscriptions/#{token}/unsubscribe" - end - - def full_name - "#{salutation} #{first_name} #{last_name}" - end -end diff --git a/app/models/user.rb b/app/models/user.rb deleted file mode 100644 index 5cf8e45..0000000 --- a/app/models/user.rb +++ /dev/null @@ -1,20 +0,0 @@ -class User < ActiveRecord::Base - acts_as_authentic - - has_many :categories - has_many :documents - has_many :collections - has_many :images - - validates_presence_of :email - - def deliver_password_reset_instructions! - reset_perishable_token! - NineAuthMailer.deliver_password_reset_instructions(self) - end - - def generate_token - self.token = rand(36**64).to_s(36) - self.save - end -end \ No newline at end of file diff --git a/app/models/user_session.rb b/app/models/user_session.rb deleted file mode 100644 index bcae102..0000000 --- a/app/models/user_session.rb +++ /dev/null @@ -1,3 +0,0 @@ -class UserSession < Authlogic::Session::Base - -end \ No newline at end of file diff --git a/app/models/video.rb b/app/models/video.rb deleted file mode 100644 index 292464c..0000000 --- a/app/models/video.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Video < Asset - belongs_to :collection -end diff --git a/app/views/categories/_list_documents.html.erb b/app/views/categories/_list_documents.html.erb deleted file mode 100644 index 7c88c18..0000000 --- a/app/views/categories/_list_documents.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<% documents.each do |document| %> -

    <%=h document.title %>

    - <% if document.meta.text %> -
    <%= document.meta.text %>
    - <% end %> -<% end %> \ No newline at end of file diff --git a/app/views/categories/show.html.erb b/app/views/categories/show.html.erb deleted file mode 100644 index c4c7a04..0000000 --- a/app/views/categories/show.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    <%=h @category.title %>

    -<%= render :partial => 'list_documents', :locals => { :documents => @documents } %> \ No newline at end of file diff --git a/app/views/documents/search.html.erb b/app/views/documents/search.html.erb deleted file mode 100644 index 26bb480..0000000 --- a/app/views/documents/search.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -
    -

    Suche nach "<%=h params[:q] %>"

    - -
      - <% @documents.each do |document| %> -
    1. <%= link_to h(document.title), category_path(document.category) %>
    2. - <% end %> -
    - - -
    \ No newline at end of file diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb deleted file mode 100644 index c5e8cc7..0000000 --- a/app/views/documents/show.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -

    <%=h @document.title %>

    -
    - Please provide your own template for displaying documents -
    diff --git a/app/views/layouts/vrame.html.erb b/app/views/layouts/vrame.html.erb deleted file mode 100644 index 5f4fffe..0000000 --- a/app/views/layouts/vrame.html.erb +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - VRAME Site-Admin - - - - - <%= stylesheet_link_tag %w( - /vrame/stylesheets/reset.css - /vrame/stylesheets/main.css - /vrame/stylesheets/forms.css - /vrame/stylesheets/buttons.css - /vrame/stylesheets/header.css - /vrame/stylesheets/flashes.css - /vrame/stylesheets/content.css - /vrame/stylesheets/record_lists.css - /vrame/stylesheets/content_view.css - /vrame/stylesheets/sortable.css - /vrame/stylesheets/upload_form.css - /vrame/stylesheets/asset_list.css - /vrame/stylesheets/schema_builder.css - /vrame/stylesheets/rte.css - /vrame/stylesheets/jquery-ui-1.7.1/smoothness/jquery-ui-1.7.1.css - /stylesheets/vrame_specific.css - ), :cache => 'vrame_all' %> - - - - - <%= javascript_include_tag %w( - /vrame/javascripts/jquery/jquery-1.3.2.min.js - /vrame/javascripts/jquery/jquery.color.js - /vrame/javascripts/jquery/jquery-ui-1.7.2.custom.min.js - /vrame/javascripts/jquery/jquery-ui-timepicker.js - /vrame/javascripts/jquery/jquery.populateRow.js - /vrame/javascripts/jquery/jquery.rte.js - /vrame/javascripts/jquery/jquery.droppy.js - /vrame/javascripts/jquery/jquery.tipsy.js - /vrame/javascripts/jquery/jquery.placeholder.js - /vrame/javascripts/jquery/jquery.scrollTo-1.4.2-min.js - /vrame/javascripts/swfupload/swfupload.js - /vrame/javascripts/application.js - /vrame/javascripts/asset-list.js - /vrame/javascripts/upload.js - /vrame/javascripts/category-view.js - /vrame/javascripts/placemarks.js - /vrame/javascripts/schema-builder.js - /vrame/javascripts/unsaved-alert.js - ), :cache => 'vrame_all' %> - - - - - -
    - <%= render :partial => 'vrame/shared/navigation', :locals => { :category => @category, :user => current_user } %> - -
    -
    -
    - - <%- unless flash.empty? -%> -
    - <% flash.each_pair do |flashclass, message| %> - <% if flashclass == :notice %> -
    - <%=h(t(message)) %> -
    - <% else %> -
    - <%=h(t(message, :default => message)) %> -
    - <% end %> - <% end %> -
    - <%- end -%> - -
    -
    - <%= yield :subnavigation %> - <%= yield %> -
    -
    - <%= yield :sidebar %> -
    -
    - - -
    -
    - -
    - loading loading -
    - - \ No newline at end of file diff --git a/app/views/newsletter_mailer/confirmation_request.text.html.erb b/app/views/newsletter_mailer/confirmation_request.text.html.erb deleted file mode 100644 index cee8833..0000000 --- a/app/views/newsletter_mailer/confirmation_request.text.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -

    Sehr geehrte<%= (@recipient.salutation == 'Herr') ? 'r' : '' %> <%= @recipient.salutation %> <%= @recipient.first_name %> <%= @recipient.last_name %>,

    - -

    Ihre E-Mail Adresse <%= @recipient.email %> wurde auf Aoste.de für den Erhalt dieses Newsletters eingetragen.

    - -

    Sollte dies zutreffen, so bestätigen Sie bitte die Newsletter-Anmeldung durch Klick auf den folgenden Link:

    - -

    <%= link_to @recipient.confirm_url, @recipient.confirm_url %>

    - -

    Mit freundlichen Grüßen,

    - -

    Das Aoste-Team

    \ No newline at end of file diff --git a/app/views/newsletter_mailer/confirmation_request.text.plain.erb b/app/views/newsletter_mailer/confirmation_request.text.plain.erb deleted file mode 100644 index 464dc50..0000000 --- a/app/views/newsletter_mailer/confirmation_request.text.plain.erb +++ /dev/null @@ -1,11 +0,0 @@ -Sehr geehrte<%= (@recipient.salutation == 'Herr') ? 'r' : '' %> <%= @recipient.salutation %> <%= @recipient.first_name %> <%= @recipient.last_name %>, - -ihre E-Mail Adresse <%= @recipient.email %> wurde auf Aoste.de für den Erhalt dieses Newsletters eingetragen. - -Sollte dies zutreffen, so bestätigen Sie bitte die Newsletter-Anmeldung durch Klick auf den folgenden Link: - -<%= @recipient.confirm_url %> - -Mit freundlichen Grüßen, - -Das Aoste-Team \ No newline at end of file diff --git a/app/views/newsletter_mailer/unsubscribe_message.text.html.erb b/app/views/newsletter_mailer/unsubscribe_message.text.html.erb deleted file mode 100644 index ff45712..0000000 --- a/app/views/newsletter_mailer/unsubscribe_message.text.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

    Sehr geehrte<%= (@recipient.salutation == 'Herr') ? 'r' : '' %> <%= @recipient.salutation %> <%= @recipient.first_name %> <%= @recipient.last_name %>,

    - -

    ihre E-Mail Adresse wurde erfolgreich aus dem Aoste-Newsletter entfernt.

    - -

    Mit freundlichen Grüßen,

    - -

    Das Aoste-Team

    \ No newline at end of file diff --git a/app/views/newsletter_mailer/unsubscribe_message.text.plain.erb b/app/views/newsletter_mailer/unsubscribe_message.text.plain.erb deleted file mode 100644 index c53fc30..0000000 --- a/app/views/newsletter_mailer/unsubscribe_message.text.plain.erb +++ /dev/null @@ -1,7 +0,0 @@ -Sehr geehrte<%= (@recipient.salutation == 'Herr') ? 'r' : '' %> <%= @recipient.salutation %> <%= @recipient.first_name %> <%= @recipient.last_name %>, - -ihre E-Mail Adresse wurde erfolgreich aus dem Aoste-Newsletter entfernt. - -Mit freundlichen Grüßen, - -Das Aoste-Team \ No newline at end of file diff --git a/app/views/newsletter_mailer/welcome_message.text.html.erb b/app/views/newsletter_mailer/welcome_message.text.html.erb deleted file mode 100644 index 0a63e8c..0000000 --- a/app/views/newsletter_mailer/welcome_message.text.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -

    Sehr geehrte<%= (@recipient.salutation == 'Herr') ? 'r' : '' %> <%= @recipient.salutation %> <%= @recipient.first_name %> <%= @recipient.last_name %>,

    - -

    ihre E-Mail Adresse wurde erfolgreich im Aoste-Newsletter eingetragen.

    - -

    Mit freundlichen Grüßen,

    - -

    Das Aoste-Team

    - -

    Falls Sie den Aoste-Newsletter in Zukunft nicht mehr erhalten wollen, klicken Sie bitte hier:

    - -

    <%= link_to @recipient.unsubscribe_url, @recipient.unsubscribe_url %>

    \ No newline at end of file diff --git a/app/views/newsletter_mailer/welcome_message.text.plain.erb b/app/views/newsletter_mailer/welcome_message.text.plain.erb deleted file mode 100644 index 4a70adf..0000000 --- a/app/views/newsletter_mailer/welcome_message.text.plain.erb +++ /dev/null @@ -1,11 +0,0 @@ -Sehr geehrte<%= (@recipient.salutation == 'Herr') ? 'r' : '' %> <%= @recipient.salutation %> <%= @recipient.first_name %> <%= @recipient.last_name %>, - -ihre E-Mail Adresse wurde erfolgreich im Aoste-Newsletter eingetragen. - -Mit freundlichen Grüßen, - -Das Aoste-Team - -Falls Sie den Aoste-Newsletter in Zukunft nicht mehr erhalten wollen, klicken Sie bitte hier: - -<%= @recipient.unsubscribe_url %> \ No newline at end of file diff --git a/app/views/nine_auth/backend/users/index.html.erb b/app/views/nine_auth/backend/users/index.html.erb deleted file mode 100644 index 122c222..0000000 --- a/app/views/nine_auth/backend/users/index.html.erb +++ /dev/null @@ -1,22 +0,0 @@ - -
      - <% for user in @users do %> -
    • -
      - - <%= link_to user.email, backend_user_path(user) %> - -
      -
      - - <%= link_to 'Editieren', edit_backend_user_path(user) %> - <%= link_to 'Löschen', [:backend, user], :method => :delete, :confirm => 'Wirklich löschen?' %> -
      -
    • - <% end %> -
    \ No newline at end of file diff --git a/app/views/nine_auth/backend/users/show.html.erb b/app/views/nine_auth/backend/users/show.html.erb deleted file mode 100644 index 0fa8328..0000000 --- a/app/views/nine_auth/backend/users/show.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -

    Benutzer <%=h @user.email %>

    - - - - - - - - - - - - - - -
    E-Mail:<%=h @user.email %>
    Aktiv:
    Administrator:

    - -<%= link_to 'Benutzer bearbeiten', edit_backend_user_path(@user) %> \ No newline at end of file diff --git a/app/views/subscriptions/create.html.erb b/app/views/subscriptions/create.html.erb deleted file mode 100644 index 80a3f35..0000000 --- a/app/views/subscriptions/create.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

    Newsletter-Anmeldung

    - -

    Vielen Dank! Ihre E-Mail-Adresse wurde erfolgreich eingetragen.

    - -

    Nächster Schritt: Abonnement bestätigen

    - -

    Sie haben soeben eine E-Mail erhalten, die einen Bestätigungs-Link enthält. Um die Newsletter-Anmeldung abzuschließen, rufen Sie bitte diesen Link auf.

    - -

    Diese Bestätigung dient Ihrer Sicherheit und schützt Sie vor unerwünschten E-Mails: So ist garantiert, dass kein Fremder Ihre Mail-Adresse einträgt.

    \ No newline at end of file diff --git a/app/views/vrame/assets/_assetable.html.erb b/app/views/vrame/assets/_assetable.html.erb deleted file mode 100644 index 4332d95..0000000 --- a/app/views/vrame/assets/_assetable.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -<% assetable = asset.assetable %> -<% assetable_type = asset.assetable_type %> -<% if assetable %> - <% if assetable_type == 'Document' %> -

    - Dokument - <%= link_to assetable.title, [:edit, :vrame, assetable] %> -

    - <% elsif assetable_type == 'Collection' %> - <% collectionable = assetable.collectionable %> - <% if collectionable %> -

    - Collection vom <%=h collectionable.class %> - <%= link_to h(collectionable.title), [:edit, :vrame, collectionable] %> -

    - <% else %> -

    Collection ohne Zugehörigkeit

    - <% end %> - <% else %> -

    <%= link_to "#{assetable_type}: #{assetable.try(:title)} ", "/vrame/assets/#{asset.id}" %>

    - <% end %> -<% else %> -

    möglicherwese verwaist (kein Verweis von Asset auf Assetable, ggf. nur umgekehrt)

    -<% end %> \ No newline at end of file diff --git a/app/views/vrame/assets/edit.html.erb b/app/views/vrame/assets/edit.html.erb deleted file mode 100644 index ea47e03..0000000 --- a/app/views/vrame/assets/edit.html.erb +++ /dev/null @@ -1,56 +0,0 @@ - - -<% form_for :asset, @asset, :url => { :action => "update" }, :html => { :method => :put, :multipart => true } do |f| %> - -
    -
      -
    • - <%= f.text_field :title, :placeholder => 'Titel', :class => 'big' %> <%= f.error_message_on :title %> -
    • -
    -
    - -
    -

    Dateianhang

    -
      -
    • Dateiname: <%=h @asset.file.original_filename %>
    • -
    • Dateigröße: <%=h number_to_human_size(@asset.file.size) %>
    • - <% if @asset.is_a?(Image) %> -
    • <%= image_tag @asset.file.url(:thumbnail_square), :alt => "" %>
    • - <% end %> -
    • - <%= f.label :file, "Neue Datei hochladen" %> - <%= f.file_field :file %> -
    • -
    -
    - -
    -

    Posterframe

    -
      -
    • Dateiname: <%=h @asset.posterframe.original_filename %>
    • -
    • Dateigröße: <%=h number_to_human_size(@asset.posterframe.size) %>
    • -
    • <%= image_tag @asset.posterframe.url(:original), :alt => "" %>
    • -
    • - <%= f.label :posterframe, "Neues Posterframe hochladen" %> - <%= f.file_field :posterframe %> -
    • -
    -
    - -
    -

    Elternobjekt

    - <%= render :partial => 'vrame/assets/assetable', :locals => { :asset => @asset } %> -
    - -
    -
      -
    • - <%= f.submit 'Speichern', :class => 'submit' %> oder <%= link_to '« zurück', vrame_assets_path %> -
    • -
    -
    - -<% end %> \ No newline at end of file diff --git a/app/views/vrame/assets/index.html.erb b/app/views/vrame/assets/index.html.erb deleted file mode 100644 index 6f7326c..0000000 --- a/app/views/vrame/assets/index.html.erb +++ /dev/null @@ -1,36 +0,0 @@ - - -
    - - - - - - - - - - - - - <% for asset in @assets do %> - "> - - - - - - - - <% end %> - -
    IdThumbnailDateinameGrößeZugehörigkeitFunktionen
    <%=h asset.id %><%= image_tag asset.file.url(:thumbnail_square), :alt => "" %><%= link_to h(asset.file.original_filename), edit_vrame_asset_path(asset) %><%= number_to_human_size(asset.file.size) %> - <%= render :partial => 'vrame/assets/assetable', :locals => { :asset => asset } %> - - <%= link_to image_tag("/vrame/images/admin/edit.png"), edit_vrame_asset_path(asset) %> - <%= link_to image_tag("/vrame/images/admin/delete.png"), vrame_asset_path(asset), :method => :delete, :confirm => 'Wirklich löschen?' %> -
    -
    -<%= render :partial => 'vrame/shared/pagination', :locals => { :paginatable => @assets } %> \ No newline at end of file diff --git a/app/views/vrame/categories/_category.html.erb b/app/views/vrame/categories/_category.html.erb deleted file mode 100644 index 1009aac..0000000 --- a/app/views/vrame/categories/_category.html.erb +++ /dev/null @@ -1,36 +0,0 @@ -
    - -
    - <%= link_to 'Nach oben verschieben', [:order_up, :vrame, category] %> - <%= link_to 'Nach unten verschieben', [:order_down, :vrame, category] %> -
    - -
    - <% if category.published %> - <%= link_to 'Verstecken', [:unpublish, :vrame, category], :id => "unpublish-category-#{category.to_param}" %> - <% else %> - <%= link_to 'Veröffentlichen', [:publish, :vrame, category], :id => "publish-category-#{category.to_param}" %> - <% end %> - <%= link_to 'Editieren', [:edit, :vrame, category], :id => "edit-category-#{category.to_param}" %> - <%= link_to 'Löschen', [:vrame, category], :method => :delete, :confirm => 'Wirklich löschen?', :id => "delete-category-#{category.to_param}" %> - <%= link_to 'Dokument hinzufügen', - category.backend_url.empty? ? [:new, :vrame, category, :document] : category.backend_url_path + '/new', - :id => "add-document-to-category-#{category.to_param}" - %> - <%= link_to 'Vorschau', - category.frontend_path, - :id => "preview-category-#{category.to_param}" - %> -
    - -
    - <% if category.backend_url.empty? %> - <%= link_to category_title(category), category, :class => "category-button", :id => "select-category-#{category.to_param}" %> - <% else %> - <%= link_to category_title(category), category.backend_url_path, :class => 'backend-url', :id => "select-category-#{category.to_param}" %> - <% end %> -
    - -
    \ No newline at end of file diff --git a/app/views/vrame/categories/_documents.html.erb b/app/views/vrame/categories/_documents.html.erb deleted file mode 100644 index 97c7e60..0000000 --- a/app/views/vrame/categories/_documents.html.erb +++ /dev/null @@ -1,70 +0,0 @@ -
      -<% documents.each do |document| %> - - <% image = nil %> - <% %w(image bild photo foto thumbnail).each do |field_name| %> - <% next unless document.meta.schema.has_field?(field_name) %> - <% field = document.meta[field_name] %> - <% if field.is_a?(Asset) && field.file.file? && File.exist?(field.file.path) %> - <% image = image_tag(field.file.url(:vrame_backend), :alt => '') %> - <% break %> - <% end %> - <% end %> - -
    • - -
      - <%= link_to h(document.title), [:edit, :vrame, document], :title => 'Editieren' %> -
      - - <% if image %> -
      <%= image %>
      - <% end %> - -
      - <%= link_to h(document.to_param), [:edit, :vrame, document], :title => 'Editieren' %> -
      - -
      - <% if document.published %> - <%= link_to 'Verstecken', [:unpublish, :vrame, document] %> - <% else %> - <%= link_to 'Veröffentlichen', [:publish, :vrame, document] %> - <% end %> - <%= link_to 'Editieren', [:edit, :vrame, document] %> - <%= link_to 'Löschen', [:vrame, document], :method => :delete, :confirm => 'Wirklich löschen?' %> - <%= link_to 'Vorschau', document %> -
      -
    • -<% end %> -<% if category != nil and documents.size == 0 %> -
    • -
      - Die Kategorie „<%=h category.title %>“ enthält noch keine Dokumente. Wollen Sie ein <%= link_to "Dokument hinzufügen", category.backend_url.empty? ? [:new, :vrame, category, :document] : category.backend_url_path + '/new' %>? -
      -
    • -<% end %> -
    - -<% if documents.first %> - -<% end %> \ No newline at end of file diff --git a/app/views/vrame/categories/_form.html.erb b/app/views/vrame/categories/_form.html.erb deleted file mode 100644 index ef9c9b6..0000000 --- a/app/views/vrame/categories/_form.html.erb +++ /dev/null @@ -1,118 +0,0 @@ -<% form_for [:vrame, category] do |f| %> - -
    -
      -
    • - <%= f.text_field :title, :placeholder => 'Titel', :class => 'big' %> - <%= f.error_message_on :title %> -
    • - -
    • - <%= render :partial => 'vrame/shared/slug_field', :locals => { :sluggable => category } %> -
    • - -
    • - <%= f.label :parent_id, 'Eltern-Kategorie:' %> - <%= tree_select(:category, :parent_id, Category.by_language(category.language).roots, :id, :title, :include_blank => true) %> -
    • -
    -
    - -
    -

    Dokument-Template

    - <%= render :partial => 'vrame/categories/schema_builder/schema_builder', - :locals => { :schema => category.schema, :schema_attribute => 'schema' } %> -
    - - <% unless category.new_record? %> -
    - <%= link_to "Eigenschema editieren", edit_eigenschema_vrame_category_path(@category), :class => "button invert" %> - <%= link_to "Meta-Informationen editieren", edit_eigenvalues_vrame_category_path(@category), :class => "button invert" %> -
    - <% end%> - -
    -

    Meta-Tags

    -
      -
    • - <%= f.label :meta_title, "Browser-Titel:" %> - <%= f.text_field :meta_title %> - <%= f.error_message_on :meta_title %> -
    • -
    • - <%= f.label :meta_keywords, "Meta-Keywords:" %> - <%= f.text_field :meta_keywords %> - <%= f.error_message_on :meta_keywords %> -
    • -
    • - <%= f.label :meta_description, "Meta-Description:" %> - <%= f.text_field :meta_description %> - <%= f.error_message_on :meta_description %> -
    • -
    -
    - -
    -

    Sichtbarkeit

    -
      -
    • - <%= f.labelled_check_box :published, "Veröffentlicht" %> -
    • -
    • - <%= f.labelled_check_box :hide_in_nav, "Im Menü verstecken (Frontend)" %> -
    • -
    • - <%= f.labelled_check_box :short_navigation, "Zeige in Schnell-Navigation (Backend)" %> -
    • -
    -
    - -
    -

    Templates

    -
      -
    • - <%= f.label :template, "Template:" %> - <%= f.text_field :template %> - <%= f.error_message_on :template %> -
    • -
    • - <%= f.label :layout, "Layout:" %> - <%= f.text_field :layout %> - <%= f.error_message_on :layout %> -
    • -
    -
    - -
    -

    URLs (eigene Controller)

    -
      -
    • - <%= f.label :document_template, "Dokumenten Template:" %> - <%= f.text_field :document_template %> <%= f.error_message_on :document_template %> -
    • -
    • - <%= f.label :document_layout, "Dokumenten Layout:" %> - <%= f.text_field :document_layout %> <%= f.error_message_on :document_layout %> -
    • -
    • - <%= f.label :url, "Frontend-URL:" %> - <%= f.text_field :url %> - <%= f.error_message_on :url %> -
    • -
    • - <%= f.label :backend_url, "Backend-URL:" %> - <%= f.text_field :backend_url %> - <%= f.error_message_on :backend_url %> -
    • -
    -
    - -
      -
    • - <%= f.submit 'Speichern', :class => 'submit' %> oder <%= link_to '« zurück', vrame_categories_path %> -
    • -
    - -<% end %> - -<%= yield :schema_builder_after_form %> \ No newline at end of file diff --git a/app/views/vrame/categories/edit.html.erb b/app/views/vrame/categories/edit.html.erb deleted file mode 100644 index d2abc24..0000000 --- a/app/views/vrame/categories/edit.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    Kategorie editieren

    -<%= render :partial => 'form', :locals => { :category => @category } %> diff --git a/app/views/vrame/categories/edit_eigenschema.html.erb b/app/views/vrame/categories/edit_eigenschema.html.erb deleted file mode 100644 index 41781e8..0000000 --- a/app/views/vrame/categories/edit_eigenschema.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -

    Eigenschema der Kategorie

    - -<% form_for [:vrame, @category] do |f| %> - -
    - <%= render :partial => 'vrame/categories/schema_builder/schema_builder', - :locals => { :schema => @category.eigenschema, :schema_attribute => 'eigenschema' } %> -
    - -
      -
    • - <%= f.submit 'Speichern', :class => 'submit' %> oder <%= link_to '« zurück', vrame_categories_path %> -
    • -
    - -<% end %> - -<%= yield :schema_builder_after_form %> \ No newline at end of file diff --git a/app/views/vrame/categories/edit_eigenvalues.html.erb b/app/views/vrame/categories/edit_eigenvalues.html.erb deleted file mode 100644 index 301db4e..0000000 --- a/app/views/vrame/categories/edit_eigenvalues.html.erb +++ /dev/null @@ -1,22 +0,0 @@ -

    Meta-Informationen der Kategorie

    - -<% form_for [:vrame, @category] do |f| %> - -
    - <% @category.eigenschema.fields.each do |field| %> - <%= render :partial => 'vrame/shared/meta_editor/meta_field', :locals => { - :parent => @category, - :parent_name => 'category', - :field => field, - :schema_attribute => 'eigenschema' - } %> - <% end %> -
    - -
      -
    • - <%= f.submit 'Speichern', :class => 'submit' %> oder <%= link_to '« zurück', vrame_categories_path %> -
    • -
    - -<% end %> \ No newline at end of file diff --git a/app/views/vrame/categories/index.html.erb b/app/views/vrame/categories/index.html.erb deleted file mode 100644 index 4c7e76a..0000000 --- a/app/views/vrame/categories/index.html.erb +++ /dev/null @@ -1,25 +0,0 @@ - - -
    -
    - <% category_tree @categories do |category, level| %> - <%= render :partial => 'vrame/categories/category', :locals => { :category => category, :level => level } %> - <% end %> -
    -
    - <%= render :partial => 'vrame/categories/documents', :locals => { :documents => @documents, :category => @active_category } %> -
    -
    \ No newline at end of file diff --git a/app/views/vrame/categories/new.html.erb b/app/views/vrame/categories/new.html.erb deleted file mode 100644 index d5bcf33..0000000 --- a/app/views/vrame/categories/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<%= render :partial => 'vrame/shared/breadcrumbs', :locals => { :breadcrumbs => @breadcrumbs } %> - -

    Neue Kategorie

    - -<%= render :partial => 'form', :locals => { :category => @category, :schema => @schema } %> diff --git a/app/views/vrame/categories/schema_builder/_asset_styles.html.erb b/app/views/vrame/categories/schema_builder/_asset_styles.html.erb deleted file mode 100644 index 463040b..0000000 --- a/app/views/vrame/categories/schema_builder/_asset_styles.html.erb +++ /dev/null @@ -1,36 +0,0 @@ -<% field = nil unless defined?(field) %> - - - - - -

    Grafik-Größen

    - -

    Die Schlüssel müssen gültige Ruby-Variablenname sein (z.B. sidebar_thumb), die Größen gültige ImageMagick-Formate (z.B. 150x100).

    - -
      - <% for style in (field.try(:styles) || Array.new(3)) %> - <% if style.is_a?(Hash) %> - <% key_s = style['key'] %> - <% style_s = style['style'] %> - <% else %> - <% key_s = style_s = '' %> - <% end %> - -
    • -

      -

      -
    • - <% end %> -
    - -

    Größe hinzufügen

    - - - \ No newline at end of file diff --git a/app/views/vrame/categories/schema_builder/_schema_builder.html.erb b/app/views/vrame/categories/schema_builder/_schema_builder.html.erb deleted file mode 100644 index 0139601..0000000 --- a/app/views/vrame/categories/schema_builder/_schema_builder.html.erb +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - -<% schema.fields.each do |field| %> - <%= render :partial => 'vrame/categories/schema_builder/schema_field', :locals => { :field => field } %> -<% end %> - -
    TypName / Interner SchlüsselBeschreibungErforderlichAktionen
    - -
    - -

    - -

    - -

    Feld hinzufügen

    - -
    - -<%# Populate Row Prototypes %> -<% content_for :schema_builder_after_form do %> - - - <%= render :partial => 'vrame/categories/schema_builder/schema_field' %> - - - <%= render :partial => 'vrame/categories/schema_builder/asset_styles' %> - - - <%= render :partial => 'vrame/categories/schema_builder/select_options', :locals => { :type => 'Select' } %> - - - <%= render :partial => 'vrame/categories/schema_builder/select_options', :locals => { :type => 'MultiSelect' } %> - -
    -<% end %> \ No newline at end of file diff --git a/app/views/vrame/categories/schema_builder/_schema_field.html.erb b/app/views/vrame/categories/schema_builder/_schema_field.html.erb deleted file mode 100644 index 30817ad..0000000 --- a/app/views/vrame/categories/schema_builder/_schema_field.html.erb +++ /dev/null @@ -1,49 +0,0 @@ -<% field = nil unless defined?(field) %> -<% visible_type = field ? /([a-zA-z]+)$/.match(field.class.name)[1] : '' %> -<% class_name = (field and %w(Asset Collection Select MultiSelect).include?(visible_type) ? ' has-field-options' : '') %> - - - - - <% if field %> - - <% end %> - -

    <%=h visible_type %>

    - - - -

    - - -

    -

    - - -

    - - - - - - - - - - - - - Entfernen - - - - -<%# Field options %> -<% if field.is_a?(JsonObject::Types::Asset) || field.is_a?(JsonObject::Types::Collection) %> - <%= render :partial => 'vrame/categories/schema_builder/asset_styles', :locals => { :field => field } %> -<% elsif field.is_a?(JsonObject::Types::Select) || field.is_a?(JsonObject::Types::MultiSelect) %> - <%= render :partial => 'vrame/categories/schema_builder/select_options', :locals => { :field => field } %> -<% end %> diff --git a/app/views/vrame/categories/schema_builder/_select_options.html.erb b/app/views/vrame/categories/schema_builder/_select_options.html.erb deleted file mode 100644 index b91b4da..0000000 --- a/app/views/vrame/categories/schema_builder/_select_options.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<% field = nil unless defined?(field) %> -<% is_multi = field.is_a?(JsonObject::Types::MultiSelect) %> - - - - - -

    Optionen für <%= is_multi ? 'Mehrfachauswahl' : 'Auswahl' %>

    - -
      - <% for option in (field.try(:options) || Array.new(4)) %> - <% option ||= '' %> -
    • - <% end %> -
    - -

    Option hinzufügen

    - - - \ No newline at end of file diff --git a/app/views/vrame/collections/rearrange.html.erb b/app/views/vrame/collections/rearrange.html.erb deleted file mode 100644 index 27c5600..0000000 --- a/app/views/vrame/collections/rearrange.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -

    Collection sortieren

    - -<% if @collection.collectionable %> -

    - Collection vom <%= @collection.collectionable.class %> - <%= link_to h(@collection.collectionable.title), [:edit, :vrame, @collection.collectionable] %> -

    -<% end %> - -
      - <% @collection.assets.each do |asset| %> -
    • -
      - <%=h asset.title %> -
      -
    • - <% end %> -
    - - \ No newline at end of file diff --git a/app/views/vrame/documents/_form.html.erb b/app/views/vrame/documents/_form.html.erb deleted file mode 100644 index 692e101..0000000 --- a/app/views/vrame/documents/_form.html.erb +++ /dev/null @@ -1,87 +0,0 @@ -<% form_for [:vrame, category, document] do |f| %> - <%= f.hidden_field :category_id, :value => category.id %> - -
    -
      -
    • - <%= f.text_field :title, :placeholder => 'Titel', :class => 'big' %> <%= f.error_message_on :title %> -
    • - -
    • - <%= render :partial => 'vrame/shared/slug_field', :locals => { :sluggable => document } %> -
    • -
    -
    - -
    -

    Sichtbarkeit

    -
      -
    • - <%= f.labelled_check_box :published, "Veröffentlicht" %> -
    • -
    • - <%= f.labelled_check_box :searchable, "Durchsuchbar" %> -
    • -
    -
    - -
    -

    Meta-Informationen

    -
      - <% category.schema.fields.each do |field| %> - <%= render :partial => 'vrame/shared/meta_editor/meta_field', :locals => { - :parent => document, - :parent_name => 'document', - :field => field - } %> - <% end %> -
    -
    - -
    -

    Meta-Tags

    -
      -
    • - <%= f.label :meta_title, "Browser-Titel:" %> - <%= f.text_field :meta_title %> <%= f.error_message_on :meta_title %> -
    • -
    • - <%= f.label :meta_keywords, "Meta-Keywords:" %> - <%= f.text_field :meta_keywords %> <%= f.error_message_on :meta_keywords %> -
    • -
    • - <%= f.label :meta_description, "Meta-Description:" %> - <%= f.text_field :meta_description %> <%= f.error_message_on :meta_description %> -
    • -
    -
    - -
    -

    Systeminformationen

    -
      -
    • - <%= f.label :template, "Template:" %> - <%= f.text_field :template %> <%= f.error_message_on :template %> -
    • -
    • - <%= f.label :layout, "Layout:" %> - <%= f.text_field :layout %> <%= f.error_message_on :layout %> -
    • -
    • - <%= f.label :url, "URL:" %> - <%= f.text_field :url %> <%= f.error_message_on :url %> -
    • -
    • - <%= f.label :backend_url, "Backend-URL:" %> - <%= f.text_field :backend_url %> <%= f.error_message_on :backend_url %> -
    • -
    -
    - -
      -
    • - <%= f.submit 'Speichern', :class => 'submit' %> oder <%= link_to '« zurück', vrame_categories_path %> -
    • -
    - -<% end %> \ No newline at end of file diff --git a/app/views/vrame/documents/edit.html.erb b/app/views/vrame/documents/edit.html.erb deleted file mode 100644 index 6e9990d..0000000 --- a/app/views/vrame/documents/edit.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    Dokument editieren

    -<%= render :partial => 'form', :locals => { :category => @document.category, :document => @document, :schema => @schema } %> diff --git a/app/views/vrame/documents/index.html.erb b/app/views/vrame/documents/index.html.erb deleted file mode 100644 index d647158..0000000 --- a/app/views/vrame/documents/index.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -
      - <% @documents.each do |documents| %> -
    • <%=h documents.title %>
    • - <% end %> -
    diff --git a/app/views/vrame/documents/new.html.erb b/app/views/vrame/documents/new.html.erb deleted file mode 100644 index 8da75af..0000000 --- a/app/views/vrame/documents/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<%= render :partial => 'vrame/shared/breadcrumbs', :locals => { :breadcrumbs => @breadcrumbs } %> - -

    Neues Dokument

    - -<%= render :partial => 'form', :locals => { :category => @category, :document => @document, :schema => @schema } %> diff --git a/app/views/vrame/languages/_form.html.erb b/app/views/vrame/languages/_form.html.erb deleted file mode 100644 index f79cab1..0000000 --- a/app/views/vrame/languages/_form.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<% form_for [:vrame, language] do |f| %> -
      -
    • - <%= f.label :name, "Name:" %> - <%= f.text_field :name %> <%= f.error_message_on :name %> -
    • -
    • - <%= f.label :iso2_code, "ISO2 Code:" %> - <%= f.text_field :iso2_code %> <%= f.error_message_on :iso2_code %> -
    • -
    • - <%= f.submit 'Speichern', :class => 'submit' %> oder <%= link_to '« zurück', admin_languages_path %> -
    • -
    -<% end %> \ No newline at end of file diff --git a/app/views/vrame/languages/edit.html.erb b/app/views/vrame/languages/edit.html.erb deleted file mode 100644 index d82909e..0000000 --- a/app/views/vrame/languages/edit.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    Sprache editieren

    -<%= render :partial => 'form', :locals => { :language => @language } %> diff --git a/app/views/vrame/languages/index.html.erb b/app/views/vrame/languages/index.html.erb deleted file mode 100644 index c3a285a..0000000 --- a/app/views/vrame/languages/index.html.erb +++ /dev/null @@ -1,39 +0,0 @@ - - -
    - - - - - - - - - - - <% for language in @languages do %> - "> - - - - - - <% end %> - -
    IdNameISO2 CodeFunktionen
    - <%=h language.id %> - - <%=h language.name %> - - <%=h language.iso2_code %> - - <%= link_to "Edit", edit_admin_language_path(language.id) %> - <%= link_to "Delete", [:vrame, language], :method => :delete, :confirm => 'Wirklich löschen?' %> -
    -
    -<%= render :partial => 'vrame/shared/pagination', :locals => { :paginatable => @languages } %> \ No newline at end of file diff --git a/app/views/vrame/languages/new.html.erb b/app/views/vrame/languages/new.html.erb deleted file mode 100644 index fc9b041..0000000 --- a/app/views/vrame/languages/new.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    Neue Sprache

    -<%= render :partial => 'form', :locals => { :language => Language.new } %> diff --git a/app/views/vrame/mailer/newsletters/_form.html.erb b/app/views/vrame/mailer/newsletters/_form.html.erb deleted file mode 100644 index dbe986c..0000000 --- a/app/views/vrame/mailer/newsletters/_form.html.erb +++ /dev/null @@ -1,48 +0,0 @@ -<% form_for [:vrame, :mailer, newsletter] do |f| %> - -
    -
      -
    • - <%= f.text_field :title, :placeholder => 'Titel', :class => 'big' %> <%= f.error_message_on :title %> -
    • - -
    • - <%= tooltip 'Verwendung des Titels', 'Erscheint als Titel der Newsletter-Email im Postfach des Empfängers. Wird auch für das Newsletter-Archiv verwendet.' %> -
    • -
    -
    - -
    - <%= f.label :body, 'Newsletter-Inhalt' %> - -
    - <%= f.text_area :body, :class => 'rte-zone' %> -
    - -

    <%= tooltip 'Platzhalter', 'Diese mit einem $-Zeichen beginnenden Wörter werden für jeden einzelnen Empfänger durch die jeweiligen persönlichen Daten ersetzt.' %>

    - -
      -
    • $ANREDE - Anrede (Herr/Frau)
    • -
    • $VORNAME - Vorname des Empfängers
    • -
    • $NACHNAME - Nachname des Empfängers
    • -
    • $ABMELDUNG_URL - Direktlink zur Newsletter-Abmeldung des jeweiligen Empfängers
    • -
    -
    - -
    - <%= f.label :publish_on, 'Absendezeitpunkt' %> - -
    - <%= f.datetime_select :publish_on, :start_year => Date.today.year, :default => 3.days.from_now.midnight %> -
    - - <%= tooltip 'Information zum Absendezeitpunkt', 'Der Newsletter wird zum hier angegebenen Zeitpunkt an alle eingetragenen Abonnenten versendet. Der Versand kann nicht mehr rückgängig gemacht werden.' %> -
    - -
      -
    • - <%= f.submit 'Speichern' %> oder <%= link_to '« zurück', vrame_mailer_newsletters_path %> -
    • -
    - -<% end %> \ No newline at end of file diff --git a/app/views/vrame/mailer/newsletters/_newsletter.html.erb b/app/views/vrame/mailer/newsletters/_newsletter.html.erb deleted file mode 100644 index a3fa33b..0000000 --- a/app/views/vrame/mailer/newsletters/_newsletter.html.erb +++ /dev/null @@ -1,22 +0,0 @@ - - <%= link_to newsletter.title, edit_vrame_mailer_newsletter_path(newsletter) %> - - <%- if newsletter.dispatched? -%> - Ja <%= tooltip 'Details', "An #{newsletter.recipients} Abonnenten versendet" %> - <%- else -%> - Nein - <%- end -%> - - - <%= I18n.l newsletter.publish_on.to_date, :format => :default %> - <%= I18n.l newsletter.publish_on, :format => :time %> - - - <%= link_to 'Bearbeiten', edit_vrame_mailer_newsletter_path(newsletter), :class => 'edit' %> - <%= link_to 'Löschen', [:vrame, :mailer, newsletter], :method => :delete, :confirm => 'Wirklich löschen?', :class => 'delete' %> - <%= link_to 'Preview', preview_vrame_mailer_newsletter_path(newsletter), :class => 'send_preview tooltip', :title => "Vorschau-Funktion: Sendet \"#{newsletter.title}\" lediglich an den aktuell eingeloggten VRAME-Benutzer (#{current_user.email})." %> - <%- unless newsletter.dispatched? -%> - <%= link_to 'Jetzt versenden', schedule_vrame_mailer_newsletter_path(newsletter), :class => 'time', :method => 'post', :confirm => "Wollen Sie \"#{newsletter.title}\" an #{Subscription.activated.count} Abonnenten versenden? Der Versand eines Newsletters ist unwiderruflich!" %> - <%- end -%> - - \ No newline at end of file diff --git a/app/views/vrame/mailer/newsletters/edit.html.erb b/app/views/vrame/mailer/newsletters/edit.html.erb deleted file mode 100644 index 2f93451..0000000 --- a/app/views/vrame/mailer/newsletters/edit.html.erb +++ /dev/null @@ -1,5 +0,0 @@ - - -

    Newsletter editieren

    - -<%= render :partial => 'form', :locals => { :newsletter => @newsletter } %> diff --git a/app/views/vrame/mailer/newsletters/index.html.erb b/app/views/vrame/mailer/newsletters/index.html.erb deleted file mode 100644 index 6635a69..0000000 --- a/app/views/vrame/mailer/newsletters/index.html.erb +++ /dev/null @@ -1,27 +0,0 @@ - - - -
    - - - - - - - - - - - <%= render @newsletters %> - -
    TitelVersandt?ZeitpunktFunktionen
    -
    - -<%= render :partial => 'vrame/shared/pagination', :locals => { :paginatable => @newsletters } %> \ No newline at end of file diff --git a/app/views/vrame/mailer/newsletters/new.html.erb b/app/views/vrame/mailer/newsletters/new.html.erb deleted file mode 100644 index df64d03..0000000 --- a/app/views/vrame/mailer/newsletters/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ - - -

    Neuer Newsletter

    - -<%= render :partial => 'form', :locals => { :newsletter => @newsletter } %> diff --git a/app/views/vrame/mailer/subscriptions/_subscription.html.erb b/app/views/vrame/mailer/subscriptions/_subscription.html.erb deleted file mode 100644 index 2beb7f9..0000000 --- a/app/views/vrame/mailer/subscriptions/_subscription.html.erb +++ /dev/null @@ -1,8 +0,0 @@ - - <%= subscription.email %> - <%= subscription.full_name %> - <%= I18n.l subscription.created_at.to_date %> - - <%= link_to 'Entfernen', vrame_mailer_subscription_path(subscription), :method => 'delete', :class => 'delete', :confirm => 'Wirklich löschen?' %> - - \ No newline at end of file diff --git a/app/views/vrame/mailer/subscriptions/index.html.erb b/app/views/vrame/mailer/subscriptions/index.html.erb deleted file mode 100644 index db6da6c..0000000 --- a/app/views/vrame/mailer/subscriptions/index.html.erb +++ /dev/null @@ -1,27 +0,0 @@ - - -
    - - - - - - - - - - - <%= render @subscriptions %> - -
    Email-AdresseVoller Name inkl. AnredeEingetragen seitFunktionen
    -
    - -<%= render :partial => 'vrame/shared/pagination', :locals => { :paginatable => @subscriptions } %> \ No newline at end of file diff --git a/app/views/vrame/shared/_asset_list.html.erb b/app/views/vrame/shared/_asset_list.html.erb deleted file mode 100644 index 960684f..0000000 --- a/app/views/vrame/shared/_asset_list.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -
      -<% for asset in assets %> - <% next if not (asset and asset.id) %> - <%= render :partial => 'vrame/shared/asset_list_item', :locals => { :asset => asset } %> -<% end %> -
    diff --git a/app/views/vrame/shared/_asset_list_item.html.erb b/app/views/vrame/shared/_asset_list_item.html.erb deleted file mode 100644 index 6bb943a..0000000 --- a/app/views/vrame/shared/_asset_list_item.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<% file = asset.file %> -
  • - - <% if asset.is_a?(Image) %> -
    - -
    - <% end %> - -
    - -

    <%=h file.original_filename %>

    -

    <%= number_to_human_size(file.size) %>

    - -

    - -

    - -

    <%= link_to 'Löschen', vrame_asset_path(asset), :class => 'smaller delete button invert', 'data-authenticity-token' => form_authenticity_token %>

    -

    <%= link_to 'Editieren', edit_vrame_asset_path(asset), :class => 'smaller edit button invert', :title => 'Vollbild-Editiermodus' %>

    - -
    - -
  • \ No newline at end of file diff --git a/app/views/vrame/shared/_breadcrumbs.html.erb b/app/views/vrame/shared/_breadcrumbs.html.erb deleted file mode 100644 index b69e5e3..0000000 --- a/app/views/vrame/shared/_breadcrumbs.html.erb +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/app/views/vrame/shared/_navigation.html.erb b/app/views/vrame/shared/_navigation.html.erb deleted file mode 100644 index e6222de..0000000 --- a/app/views/vrame/shared/_navigation.html.erb +++ /dev/null @@ -1,59 +0,0 @@ -
    -
    -
      -
    • <%= link_to 'VRAME', vrame_root_path, :class => 'logo' %>
    • - - <%- if user -%> -
    • - -
    • - -
    • <%= link_to 'Log out', user_sessions_path, :method => 'delete' %>
    • - -
    • <%=h user.email %>
    • - -
    • - <%= select("admin_current_language", "id", Language.all.map {|l| [ l.name, l.id ] }, :selected => current_language.id) %> - -
    • - - - <%- end -%> -
    - -
    -
    \ No newline at end of file diff --git a/app/views/vrame/shared/_pagination.html.erb b/app/views/vrame/shared/_pagination.html.erb deleted file mode 100644 index 8f61c75..0000000 --- a/app/views/vrame/shared/_pagination.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%- if paginatable.size > paginatable.per_page -%> -
    -
    - 10, - 25, - 50, - 100 -
    -
    - <%= will_paginate paginatable %> -
    -
    -<%- end -%> \ No newline at end of file diff --git a/app/views/vrame/shared/_slug_field.html.erb b/app/views/vrame/shared/_slug_field.html.erb deleted file mode 100644 index 81d4c20..0000000 --- a/app/views/vrame/shared/_slug_field.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= tooltip 'Permalink?', 'Aus dem aktuellen Titel wird automatisch ein Slug (»sprechender« Kurzname für Adresszeile) generiert. Bei Änderung des Titels bleiben bereits vorhandene Permalinks intakt.' %> - -<%- if controller.action_name == "edit" -%><%= url_for(sluggable) %><%- end -%> \ No newline at end of file diff --git a/app/views/vrame/shared/meta_editor/_file_upload.html.erb b/app/views/vrame/shared/meta_editor/_file_upload.html.erb deleted file mode 100644 index 5acfc10..0000000 --- a/app/views/vrame/shared/meta_editor/_file_upload.html.erb +++ /dev/null @@ -1,54 +0,0 @@ -<% if defined?(asset) : - type = 'asset' - assets = [asset] - id = asset.try(:id) -elsif defined?(collection) : - type = 'collection' - assets = collection.is_a?(Collection) ? collection.assets : [] - id = collection.try(:id) -end %> - -<% parent_name = parent.class.to_s %> -<% parent_name_lowercase = parent_name.downcase %> - -
    <%# TODO Dirty Hack %> - data-schema-class = "Category" - data-schema-id = "<%= parent.is_a?(Category) ? parent.id : parent.category.id %>" - data-schema-attr = "<%= schema_attribute %>" - data-schema-uid = "<%= uid %>" - <% end %> - <% if type == 'collection' and id -%> - data-collection-id = "<%= id %>" - <%- end %> -> - - <%# ****** Field with child id (asset or collection)%> - - - <%# ****** Field to set up child-to-parent relation %> - - - <%# ****** Placeholder element for Flash upload button %> - <% defined?(@upload_button_number) ? @upload_button_number += 1 : @upload_button_number = 1 %> -

    - Bitte aktivieren Sie Flash für den Datei-Upload. -

    - - <%# ****** Upload Queue %> -
      - - <%# ****** Collection sorting %> - <% if type == 'collection' && id %> -

      <%= link_to "Assets sortieren", rearrange_vrame_collection_path(collection), :class => 'smaller button invert' %>

      - <% end %> - - <%# ****** Asset list %> - <%= render :partial => 'vrame/shared/asset_list', :locals => { :assets => assets } %> - -
      \ No newline at end of file diff --git a/app/views/vrame/shared/meta_editor/_meta_field.html.erb b/app/views/vrame/shared/meta_editor/_meta_field.html.erb deleted file mode 100644 index 59f09a9..0000000 --- a/app/views/vrame/shared/meta_editor/_meta_field.html.erb +++ /dev/null @@ -1,83 +0,0 @@ -<% field_name = parent_name + "[meta[#{field.uid}]]" %> -<% field_id = parent_name + "-meta-#{field.uid}" %> -<% value = parent.meta[field.name] %> - -
    1. - -

      - - <% unless field.description.blank? %> -

      <%=h field.description %>

      - <% end %> - -
      - - <% case field when JsonObject::Types::String %> - - - - <% when JsonObject::Types::Text %> - - - - <% when JsonObject::Types::Bool %> - - <%= hidden_field_tag field_name, 0 %> - - - <% when JsonObject::Types::Datetime %> - - - - <% when JsonObject::Types::Select %> - - <%= render :partial => 'vrame/shared/meta_editor/select_options', :locals => { - :field => field, - :field_name => field_name, - :value => value - } %> - - <% when JsonObject::Types::MultiSelect %> - - <%= render :partial => 'vrame/shared/meta_editor/select_options', :locals => { - :field => field, - :field_name => field_name, - :value => value - } %> - - <% when JsonObject::Types::Asset %> - - <%= render :partial => 'vrame/shared/meta_editor/file_upload', :locals => { - :field_name => field_name, - :uid => field.uid, - :asset => value, - :parent => parent, - :schema_attribute => schema_attribute - } %> - - <% when JsonObject::Types::Collection %> - - <%= render :partial => 'vrame/shared/meta_editor/file_upload', :locals => { - :field_name => field_name, - :uid => field.uid, - :collection => value, - :parent => parent, - :schema_attribute => schema_attribute - } %> - - <% when JsonObject::Types::Placemark %> - - <%= render :partial => 'vrame/shared/meta_editor/placemark', :locals => { - :field_name => field_name, - :field_id => field_id, - :parent => parent, - :value => value - } %> - - <% end %> - -
      -
    2. \ No newline at end of file diff --git a/app/views/vrame/shared/meta_editor/_placemark.html.erb b/app/views/vrame/shared/meta_editor/_placemark.html.erb deleted file mode 100644 index c5a8e13..0000000 --- a/app/views/vrame/shared/meta_editor/_placemark.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<% parent_name = parent.class.to_s %> -<% parent_name_lowercase = parent_name.downcase %> - -
      - - (Karte aktualisieren) - -

      -

      - - -
      \ No newline at end of file diff --git a/app/views/vrame/shared/meta_editor/_select_options.html.erb b/app/views/vrame/shared/meta_editor/_select_options.html.erb deleted file mode 100644 index f024122..0000000 --- a/app/views/vrame/shared/meta_editor/_select_options.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -
        -<% field.options.each do |option| %> -
      1. - -
      2. -<% end %> -
      \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb deleted file mode 100644 index 9f88ebc..0000000 --- a/config/routes.rb +++ /dev/null @@ -1,52 +0,0 @@ -ActionController::Routing::Routes.draw do |map| - - # Backend - - map.namespace(:vrame) do |vrame| - # VRAME index - vrame.root :controller => 'categories', :action => 'index' - - # Categories - vrame.resources :categories, :has_many => [ :documents ], :member => { :edit_eigenschema => :get, :edit_eigenvalues => :get, :order_up => :get, :order_down => :get, :publish => :get, :unpublish => :get, :sort => :post } - vrame.resources :categories, :has_many => [ :categories ], :only => [ :new ] - - # Documents - vrame.resources :documents, :member => { :order_up => :get, :order_down => :get, :publish => :get, :unpublish => :get } - - # Languages - vrame.resources :languages - vrame.switch_language '/switch_language/:id', :controller => 'vrame', :action => 'switch_language' - - # Assets and Collections - vrame.resources :assets - vrame.resources :collections, :member => { :rearrange => :get, :sort => :post } - - # Mailer - vrame.namespace(:mailer) do |mailer| - mailer.resources :subscriptions, :only => [ :index, :destroy ] - mailer.resources :newsletters, :member => { :preview => :get, :schedule => :post } - end - end - - # Frontend - map.switch_language '/switch_language/:id', :controller => 'application', :action => 'switch_language' - - # Categories - map.resources :categories, :only => [ :show ] - map.category_documents '/categories/:category_id/documents', :controller => 'documents', :action => 'index' - map.category_documents '/categories/:category_id/documents.:format', :controller => 'documents', :action => 'index' - map.category_categories '/categories/:category_id/categories', :controller => 'categories', :action => 'index' - map.category_categories '/categories/:category_id/categories.:format', :controller => 'categories', :action => 'index' - - # Documents - map.resources :documents, :only => [ :show ] - - # Search - map.seach '/search', :controller => 'documents', :action => 'search' - - # Assets - map.download_asset '/assets/:id/download', :controller => 'assets', :action => 'download' - - # Subscriptions - map.resources :subscriptions, :only => [ :create ], :member => { :confirm => :any, :unsubscribe => :any } -end \ No newline at end of file diff --git a/db/migrate/20090831161810_vrame_setup.rb b/db/migrate/20090831161810_vrame_setup.rb deleted file mode 100644 index 1067264..0000000 --- a/db/migrate/20090831161810_vrame_setup.rb +++ /dev/null @@ -1,122 +0,0 @@ -class VrameSetup < ActiveRecord::Migration - - def self.up - - create_table "languages", :force => true do |t| - t.string "name" - t.string "iso3_code" - t.boolean "published", :default => false - - t.integer "user_id" - - t.timestamps - end - - create_table "categories", :force => true do |t| - t.string "title" - - t.string "template" - - t.string "url" - t.string "backend_url" - t.text "schema_json" - t.boolean "inherit_schema" - - t.text "meta_json" - t.string "meta_title" - t.string "meta_keywords" - t.text "meta_description" - - t.integer "position" - - t.boolean "short_navigation" - - t.boolean "published", :default => false - - t.integer "parent_id" - t.integer "language_id" - t.integer "user_id" - - t.timestamps - end - - create_table "documents", :force => true do |t| - t.string "title" - - t.string "template" - - t.string "url" - t.string "backend_url" - - t.text "meta_json" - t.string "meta_title" - t.string "meta_keywords" - t.text "meta_description" - - t.integer "position" - - t.boolean "published", :default => false - t.boolean "searchable", :default => true - - t.integer "category_id" - t.integer "language_id" - - t.integer "user_id" - t.timestamps - end - - create_table "collections", :force => true do |t| - t.string "title" - t.text "meta_json" - - t.string "unique_hash" - - t.integer "language_id" - t.integer "user_id" - t.integer "document_id" - - t.timestamps - end - - create_table "assets", :force => true do |t| - t.string "title" - t.string "type" - - t.text "meta_json" - - t.text "file_file_name" - t.string "file_content_type" - t.integer "file_file_size" - t.datetime "file_updated_at" - - t.integer "collection_id" - t.integer "language_id" - t.integer "user_id" - - t.timestamps - end - - create_table "slugs", :force => true do |t| - t.string "name" - t.integer "sluggable_id" - t.integer "sequence", :default => 1, :null => false - t.string "sluggable_type", :limit => 40 - t.string "scope", :limit => 40 - t.timestamps - end - - add_index "slugs", ["name", "sluggable_type", "scope", "sequence"], :name => "index_slugs_on_name_and_sluggable_type_and_scope_and_sequence", :unique => true - add_index "slugs", ["sluggable_id"], :name => "index_slugs_on_sluggable_id" - - end - - def self.down - drop_table "languages" - drop_table "categories" - drop_table "documents" - drop_table "collections" - drop_table "assets" - drop_table "slugs" - end - -end diff --git a/db/migrate/20090901140306_add_document_refernce_to_assets.rb b/db/migrate/20090901140306_add_document_refernce_to_assets.rb deleted file mode 100644 index f9e7598..0000000 --- a/db/migrate/20090901140306_add_document_refernce_to_assets.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddDocumentRefernceToAssets < ActiveRecord::Migration - def self.up - add_column :assets, :document_id, :integer - end - - def self.down - remove_column :assets, :document_id - end -end diff --git a/db/migrate/20090907170551_create_subscriptions.rb b/db/migrate/20090907170551_create_subscriptions.rb deleted file mode 100644 index 1c846eb..0000000 --- a/db/migrate/20090907170551_create_subscriptions.rb +++ /dev/null @@ -1,17 +0,0 @@ -class CreateSubscriptions < ActiveRecord::Migration - def self.up - create_table :subscriptions do |t| - t.string :salutation - t.string :first_name - t.string :last_name - t.string :email - t.string :token - - t.timestamps - end - end - - def self.down - drop_table :subscriptions - end -end diff --git a/db/migrate/20090907195710_create_newsletters.rb b/db/migrate/20090907195710_create_newsletters.rb deleted file mode 100644 index 0415b55..0000000 --- a/db/migrate/20090907195710_create_newsletters.rb +++ /dev/null @@ -1,17 +0,0 @@ -class CreateNewsletters < ActiveRecord::Migration - def self.up - create_table :newsletters do |t| - t.string :title - t.text :body - t.datetime :publish_on - t.boolean :dispatched, :default => false - t.integer :recipients - - t.timestamps - end - end - - def self.down - drop_table :newsletters - end -end \ No newline at end of file diff --git a/db/migrate/20090907201321_create_mailings.rb b/db/migrate/20090907201321_create_mailings.rb deleted file mode 100644 index fc9dfad..0000000 --- a/db/migrate/20090907201321_create_mailings.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateMailings < ActiveRecord::Migration - def self.up - create_table :mailings do |t| - t.references :subscription - t.references :newsletter - t.boolean :delivered, :default => false - end - end - - def self.down - drop_table :mailings - end -end diff --git a/db/migrate/20090908193910_add_active_column_to_subscriptions.rb b/db/migrate/20090908193910_add_active_column_to_subscriptions.rb deleted file mode 100644 index 742db65..0000000 --- a/db/migrate/20090908193910_add_active_column_to_subscriptions.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddActiveColumnToSubscriptions < ActiveRecord::Migration - def self.up - add_column :subscriptions, :active, :boolean, :default => false - end - - def self.down - remove_column :subscriptions, :active - end -end diff --git a/db/migrate/20090910013206_add_body_plain_text_column_to_newsletters.rb b/db/migrate/20090910013206_add_body_plain_text_column_to_newsletters.rb deleted file mode 100644 index 588a3d8..0000000 --- a/db/migrate/20090910013206_add_body_plain_text_column_to_newsletters.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddBodyPlainTextColumnToNewsletters < ActiveRecord::Migration - def self.up - add_column :newsletters, :body_plain_text, :text - end - - def self.down - remove_column :newsletters, :body_plain_text - end -end diff --git a/db/migrate/20090922091030_polymorphic_assets.rb b/db/migrate/20090922091030_polymorphic_assets.rb deleted file mode 100644 index 41ad80b..0000000 --- a/db/migrate/20090922091030_polymorphic_assets.rb +++ /dev/null @@ -1,29 +0,0 @@ -class PolymorphicAssets < ActiveRecord::Migration - def self.up - add_column :assets, :assetable_id, :integer - add_column :assets, :assetable_type, :string - - Asset.all.each do |a| - if a.document_id - p "Asset##{a.id} belongs_to Document##{a.document_id}" - a.assetable_type = "Document" - a.assetable_id = a.document_id - elsif a.collection_id - p "Asset##{a.id} belongs_to Collection##{a.collection_id}" - a.assetable_type = "Collection" - a.assetable_id = a.collection_id - end - a.save - end - - remove_column :assets, :collection_id - remove_column :assets, :document_id - end - - def self.down - remove_column :assets, :assetable_id - remove_column :assets, :assetable_type - add_column :assets, :collection_id, :integer - add_column :assets, :document_id, :integer - end -end diff --git a/db/migrate/20090922092044_polymorphic_collections.rb b/db/migrate/20090922092044_polymorphic_collections.rb deleted file mode 100644 index 0c2e7a5..0000000 --- a/db/migrate/20090922092044_polymorphic_collections.rb +++ /dev/null @@ -1,21 +0,0 @@ -class PolymorphicCollections < ActiveRecord::Migration - def self.up - add_column :collections, :collectionable_id, :integer - add_column :collections, :collectionable_type, :string - - Collection.all.each do |c| - p "Collection##{c.id} belongs_to Document##{c.document_id}" - c.collectionable_type = "Document" - c.collectionable_id = c.document_id - c.save - end - - remove_column :collections, :document_id - end - - def self.down - remove_column :collections, :collectionable_id - remove_column :collections, :collectionable_type - add_column :collections, :document_id, :integer - end -end diff --git a/db/migrate/20090924130804_add_counter_caches_to_categories.rb b/db/migrate/20090924130804_add_counter_caches_to_categories.rb deleted file mode 100644 index 870c372..0000000 --- a/db/migrate/20090924130804_add_counter_caches_to_categories.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddCounterCachesToCategories < ActiveRecord::Migration - def self.up - add_column :categories, :categories_count, :integer, :default => 0 - add_column :categories, :documents_count, :integer, :default => 0 - - Category.reset_column_information - Category.all.each do |c| - Category.update_counters c.id, :categories_count => c.children.length - Category.update_counters c.id, :documents_count => c.documents.length - end - end - - def self.down - remove_column :categories, :categories_count - remove_column :categories, :children_count - end -end diff --git a/db/migrate/20090926152514_add_layout_to_categories_and_documents.rb b/db/migrate/20090926152514_add_layout_to_categories_and_documents.rb deleted file mode 100644 index 7263484..0000000 --- a/db/migrate/20090926152514_add_layout_to_categories_and_documents.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddLayoutToCategoriesAndDocuments < ActiveRecord::Migration - def self.up - add_column :categories, :layout, :string - add_column :documents, :layout, :string - end - - def self.down - remove_column :categories, :layout - remove_column :documents, :layout - end -end diff --git a/db/migrate/20091008133350_add_position_to_assets.rb b/db/migrate/20091008133350_add_position_to_assets.rb deleted file mode 100644 index 87b5efb..0000000 --- a/db/migrate/20091008133350_add_position_to_assets.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddPositionToAssets < ActiveRecord::Migration - def self.up - add_column :assets, :position, :integer, :default => 0 - end - - def self.down - remove_column :assets, :position - end -end diff --git a/db/migrate/20091014131034_category_hide_in_nav.rb b/db/migrate/20091014131034_category_hide_in_nav.rb deleted file mode 100644 index 38c365e..0000000 --- a/db/migrate/20091014131034_category_hide_in_nav.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CategoryHideInNav < ActiveRecord::Migration - def self.up - add_column :categories, :hide_in_nav, :boolean - end - - def self.down - remove_column :categories, :hide_in_nav - end -end diff --git a/db/migrate/20091015101525_new_json_object.rb b/db/migrate/20091015101525_new_json_object.rb deleted file mode 100644 index 0b6c55a..0000000 --- a/db/migrate/20091015101525_new_json_object.rb +++ /dev/null @@ -1,61 +0,0 @@ -class NewJsonObject < ActiveRecord::Migration - def self.up - # Migrate schemas - Category.all.each do |category| - old_json_string = category.schema_json - - old_schema_hash = json_decode(old_json_string) || [] - - new_schema_hash = { - 'fields' => [] - } - - old_schema_hash.each do |field| - new_schema_hash['fields'] << { - 'uid' => field['uid'], - 'type' => field['type'], - 'title' => field['name'] - } - end - - category.schema_json = "{}" - category.schema = new_schema_hash - - category.save - - # Just fancy output from here on - num_fields = new_schema_hash['fields'].length - - puts "Converted #{num_fields} field(s) for category: #{category.to_param}" - end - - # Migrate stores - Document.all.each do |document| - old_json_string = document.meta_json - - old_store_hash = json_decode(old_json_string) || {} - - new_store_hash = { - 'values' => old_store_hash - } - - document.update_attribute(:meta_json, new_store_hash.to_json) - - # Just fancy output from here on - puts "Converted document: #{document.to_param}" - end - end - - def self.down - raise ActiveRecord::IrreversibleMigration - end -end - -def json_decode(json_string) - case json_string - when "null" - nil - else - ActiveSupport::JSON.decode(json_string) - end -end \ No newline at end of file diff --git a/db/migrate/20091019111035_doc_template_in_category.rb b/db/migrate/20091019111035_doc_template_in_category.rb deleted file mode 100644 index a725edf..0000000 --- a/db/migrate/20091019111035_doc_template_in_category.rb +++ /dev/null @@ -1,11 +0,0 @@ -class DocTemplateInCategory < ActiveRecord::Migration - def self.up - add_column :categories, :document_template, :string - add_column :categories, :document_layout, :string - end - - def self.down - remove_column :categories, :document_layout - remove_column :categories, :document_template - end -end diff --git a/db/migrate/20091104114243_new_jsonobject_to_flexitypes.rb b/db/migrate/20091104114243_new_jsonobject_to_flexitypes.rb deleted file mode 100644 index 200e12e..0000000 --- a/db/migrate/20091104114243_new_jsonobject_to_flexitypes.rb +++ /dev/null @@ -1,53 +0,0 @@ -class NewJsonobjectToFlexitypes < ActiveRecord::Migration - def self.up - puts 'NewJsonobjectToFlexitypes' - Category.all.each do |category| - puts "Migrating category '#{category.title}' (ID #{category.id})" - json = JSON.parse(category.schema_json, :create_additions => false) - next if json.has_key?('json_class') - json['json_class'] = "JsonObject::Schema" - json['fields'].each do |field| - field['json_class'] = case field['type'] - when /String/i - "JsonObject::Types::String" - when /Text/i - "JsonObject::Types::Text" - when /Datetime/i - "JsonObject::Types::Datetime" - when /Bool|Boolean/i - "JsonObject::Types::Bool" - when /File|Asset/i - "JsonObject::Types::Asset" - when /Collection/i - "JsonObject::Types::Collection" - when /Placemark/i - "JsonObject::Types::Placemark" - when /Select/i - "JsonObject::Types::Select" - when /Multiselect/i - "JsonObject::Types::Multiselect" - end - field.delete 'type' - end - category.schema_json = json.to_json - category.save - end - - Document.all.each do |document| - puts "Migrating document '#{document.title}' (ID #{document.id})" - begin - json = JSON.parse(document.meta_json, :create_additions => false) - next if json.has_key?('json_class') - json['json_class'] = "JsonObject::Store" - document.meta_json = json.to_json - document.save - rescue - puts "Error in Document #{document.id} #{document.title}" - end - end - - end - - def self.down - end -end diff --git a/db/migrate/20091104165343_collections_dont_have_meta.rb b/db/migrate/20091104165343_collections_dont_have_meta.rb deleted file mode 100644 index ebadeea..0000000 --- a/db/migrate/20091104165343_collections_dont_have_meta.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CollectionsDontHaveMeta < ActiveRecord::Migration - def self.up - remove_column :collections, :meta_json - end - - def self.down - add_column :collections, :meta_json, :text - end -end diff --git a/db/migrate/20091105165456_vrame_add_posterframe_to_assets.rb b/db/migrate/20091105165456_vrame_add_posterframe_to_assets.rb deleted file mode 100644 index 0500462..0000000 --- a/db/migrate/20091105165456_vrame_add_posterframe_to_assets.rb +++ /dev/null @@ -1,15 +0,0 @@ -class VrameAddPosterframeToAssets < ActiveRecord::Migration - def self.up - add_column :assets, :posterframe_file_name, :string - add_column :assets, :posterframe_content_type, :string - add_column :assets, :posterframe_file_size, :string - add_column :assets, :posterframe_updated_at, :datetime - end - - def self.down - remove_column :assets, :posterframe_file_name - remove_column :assets, :posterframe_content_type - remove_column :assets, :posterframe_file_size - remove_column :assets, :posterframe_updated_at - end -end diff --git a/db/migrate/20091111165203_change_iso3_to_iso2_in_languages.rb b/db/migrate/20091111165203_change_iso3_to_iso2_in_languages.rb deleted file mode 100644 index 66a895b..0000000 --- a/db/migrate/20091111165203_change_iso3_to_iso2_in_languages.rb +++ /dev/null @@ -1,14 +0,0 @@ -class ChangeIso3ToIso2InLanguages < ActiveRecord::Migration - MAP = {'deu' => 'de', 'eng' => 'en'} - def self.up - rename_column :languages, :iso3_code, :iso2_code - Language.reset_column_information - Language.find_each {|l| l.update_attribute(:iso2_code, MAP[l.iso2_code]) } - end - - def self.down - rename_column :albums, :iso2_code, :iso3_code - Language.reset_column_information - Language.find_each {|l| l.update_attribute(:iso2_code, MAP.invert[l.iso2_code]) } - end -end diff --git a/db/migrate/20091112164823_image_dimensions.rb b/db/migrate/20091112164823_image_dimensions.rb deleted file mode 100644 index f54b755..0000000 --- a/db/migrate/20091112164823_image_dimensions.rb +++ /dev/null @@ -1,15 +0,0 @@ -class ImageDimensions < ActiveRecord::Migration - def self.up - add_column :assets, :file_width, :integer - add_column :assets, :file_height, :integer - add_column :assets, :posterframe_width, :integer - add_column :assets, :posterframe_height, :integer - end - - def self.down - remove_column :assets, :posterframe_height - remove_column :assets, :posterframe_width - remove_column :assets, :file_height - remove_column :assets, :file_width - end -end diff --git a/db/migrate/20091112172212_get_dimensions_from_existing_files.rb b/db/migrate/20091112172212_get_dimensions_from_existing_files.rb deleted file mode 100644 index ad73fbc..0000000 --- a/db/migrate/20091112172212_get_dimensions_from_existing_files.rb +++ /dev/null @@ -1,26 +0,0 @@ -class GetDimensionsFromExistingFiles < ActiveRecord::Migration - def self.up - Asset.all.each do |asset| - puts "Asset #{asset}" - if asset.posterframe? - dim = Paperclip::Geometry.from_file(asset.posterframe.path(:original)) - asset.posterframe_width = dim.width - asset.posterframe_height = dim.height - puts " Posterframe: #{dim}" - end - if asset.file? && asset.file.is_image? - filepath = asset.file.path(:original) - if File.exist?(filepath) - dim = Paperclip::Geometry.from_file(filepath) - asset.file_width = dim.width - asset.file_height = dim.height - puts " File: #{dim}" - end - end - asset.save - end - end - - def self.down - end -end diff --git a/db/migrate/20091124163402_eigenschema.rb b/db/migrate/20091124163402_eigenschema.rb deleted file mode 100644 index 945a51b..0000000 --- a/db/migrate/20091124163402_eigenschema.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Eigenschema < ActiveRecord::Migration - def self.up - add_column :categories, :eigenschema_json, :text - end - - def self.down - remove_column :categories, :eigenschema_json - end -end diff --git a/docs/vrame_json_specification.html b/docs/vrame_json_specification.html deleted file mode 100644 index eb467cb..0000000 --- a/docs/vrame_json_specification.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - -VRAME JSON Interface for Categories and Documents - - - - -

      VRAME JSON Interface for Categories and Documents

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      TaskRouteController.ActionResponse
      Get Category/categories/[ID].jsoncategories.show{"updated_at": "2009-09-04T16:21:14Z", "title": "Home", "meta_keywords": "", "url": "/", "id": 4, "language_id": 1, "meta_description": "", "meta_title": "", "parent_id": 3, "created_at": "2009-09-01T11:49:30Z"}
      Get Document/documents/[ID].jsondocuments.show{"updated_at": "2009-09-02T15:02:10Z", "title": "HomeDokument", "meta_keywords": "", "url": "", "id": 12, "category_id": 4, "language_id": 1, "meta_description": "", "meta_title": "", "created_at": "2009-09-02T15:02:10Z"}
      Get Documents by Category/categories/[ID]/documents.jsondocuments.index[ {"updated_at": "2009-09-02T15:02:10Z", "title": "HomeDokument", "meta_keywords": "", "url": "", "id": 12, "category_id": 4, "language_id": 1, "meta_description": "", "meta_title": "", "created_at": "2009-09-02T15:02:10Z"}, ... ]
      Get (Sub)Categories by Category/categories/[ID]/categories.jsoncategories.index[ {"updated_at": "2009-09-04T16:21:14Z", "title": "Home", "meta_keywords": "", "url": "/", "id": 4, "language_id": 1, "meta_description": "", "meta_title": "", "parent_id": 3, "created_at": "2009-09-01T11:49:30Z"}, ... ]
      - - - \ No newline at end of file diff --git a/features/env.rb.sample b/features/env.rb.sample deleted file mode 100644 index 871a425..0000000 --- a/features/env.rb.sample +++ /dev/null @@ -1,56 +0,0 @@ -# IMPORTANT: This file was generated by Cucumber 0.4.4 -# Edit at your own peril - it's recommended to regenerate this file -# in the future when you upgrade to a newer version of Cucumber. -# Consider adding your own code to a new file instead of editing this one. - -Before do - Fixtures.reset_cache - fixtures_folder = File.join(RAILS_ROOT, 'db', 'fixtures') - fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') } - Fixtures.create_fixtures(fixtures_folder, fixtures) -end - -# Sets up the Rails environment for Cucumber -# ENV["RAILS_ENV"] ||= "cucumber" -ENV["RAILS_ENV"] = "cucumber" - -require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') -require 'cucumber/rails/world' - -# If you set this to true, each scenario will run in a database transaction. -# You can still turn off transactions on a per-scenario basis, simply tagging -# a feature or scenario with the @no-txn tag. -# -# If you set this to false, transactions will be off for all scenarios, -# regardless of whether you use @no-txn or not. -# -# Beware that turning transactions off will leave data in your database -# after each scenario, which can lead to hard-to-debug failures in -# subsequent scenarios. If you do this, we recommend you create a Before -# block that will explicitly put your database in a known state. -Cucumber::Rails::World.use_transactional_fixtures = true - -# If you set this to false, any error raised from within your app will bubble -# up to your step definition and out to cucumber unless you catch it somewhere -# on the way. You can make Rails rescue errors and render error pages on a -# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag. -# -# If you set this to true, Rails will rescue all errors and render error -# pages, more or less in the same way your application would behave in the -# default production environment. It's not recommended to do this for all -# of your scenarios, as this makes it hard to discover errors in your application. -ActionController::Base.allow_rescue = false - -require 'cucumber' -# Comment out the next line if you don't want Cucumber Unicode support -require 'cucumber/formatter/unicode' -require 'cucumber/webrat/element_locator' # Lets you do table.diff!(element_at('#my_table_or_dl_or_ul_or_ol').to_table) -require 'cucumber/rails/rspec' - -require 'webrat' -require 'webrat/core/matchers' -Webrat.configure do |config| - config.mode = :selenium - config.open_error_files = false # Set to true if you want error pages to pop up in the browser -end - diff --git a/features/github_issue7.feature b/features/github_issue7.feature deleted file mode 100644 index f9f4766..0000000 --- a/features/github_issue7.feature +++ /dev/null @@ -1,14 +0,0 @@ -@bugs -Feature: Crashing when loading deprecated cookies - When I delete an active category - as an administrator - vrame should not crash - - Scenario: The homepage - Given I am on vrame home - When I sign-in - And I follow "Neue Kategorie" - And I add the category "Navigation" - And I select the category "navigation" - And I delete the category "navigation" - Then I should see "Die Kategorie wurde gelöscht" \ No newline at end of file diff --git a/features/paths.rb.sample b/features/paths.rb.sample deleted file mode 100644 index b97c529..0000000 --- a/features/paths.rb.sample +++ /dev/null @@ -1,30 +0,0 @@ -module NavigationHelpers - # Maps a name to a path. Used by the - # - # When /^I go to (.+)$/ do |page_name| - # - # step definition in webrat_steps.rb - # - def path_to(page_name) - case page_name - - when /the home\s?page/ - '/' - - when /vrame home/ - vrame_root_path - - # Add more mappings here. - # Here is a more fancy example: - # - # when /^(.*)'s profile page$/i - # user_profile_path(User.find_by_login($1)) - - else - raise "Can't find mapping from \"#{page_name}\" to a path.\n" + - "Now, go and add a mapping in #{__FILE__}" - end - end -end - -World(NavigationHelpers) diff --git a/features/step_definitions/github_issue7_steps.rb b/features/step_definitions/github_issue7_steps.rb deleted file mode 100644 index cd51699..0000000 --- a/features/step_definitions/github_issue7_steps.rb +++ /dev/null @@ -1,28 +0,0 @@ -When /^I sign\-in$/ do - # debugger - - fill_in('user_session_email', :with => 'vrame@example.com') - fill_in('user_session_password', :with => 'vrame') - - click_button('user_session_submit') - selenium.wait_for_page_to_load -end - -When /^I add the category "([^\"]*)"$/ do |title| - click_link 'new-category' - selenium.wait_for_page_to_load - - fill_in('category_title', :with => title) - click_button 'category_submit' - selenium.wait_for_page_to_load -end - -When /^I select the category "([^\"]*)"$/ do |friendly_id| - click_link "select-category-#{friendly_id}" - selenium.wait_for_condition('selenium.browserbot.getCurrentWindow().jQuery.active == 0', 5000) -end - -When /^I delete the category "([^\"]*)"$/ do |friendly_id| - click_link "delete-category-#{friendly_id}" - selenium.wait_for_page_to_load -end \ No newline at end of file diff --git a/init.rb b/init.rb deleted file mode 100644 index 76854fa..0000000 --- a/init.rb +++ /dev/null @@ -1,90 +0,0 @@ -# Include hook code here - -load_paths.each do |path| - ActiveSupport::Dependencies.load_once_paths.delete(path) - ActiveSupport::Dependencies.load_once_paths << File.join(File.dirname(__FILE__), "lib") -end if config.environment == 'development' - -# Load JsonObject -require 'json/add/core' -require File.join(File.dirname(__FILE__), "lib", "jsonobject") - -begin - require 'nine_auth_engine' -rescue Exception => e - puts "\033[31m" - puts "VRAME requires NineAuthEngine. Install it via:" - puts "\033[36m" - puts "git submodule add git://github.com/sebastiandeutsch/nine_auth_engine.git vendor/plugins/nine_auth_engine" - puts "" - puts "or" - puts "" - puts "script/plugin install git://github.com/sebastiandeutsch/nine_auth_engine.git" - puts "" - puts "\033[0m" - raise "VRAME Bootstrap Error" -end - -config.gem 'coupa-acts_as_tree', - :lib => 'coupa-acts_as_tree', - :source => 'http://gems.github.com' - -config.gem 'binarylogic-authlogic', - :lib => 'authlogic', - :source => 'http://gems.github.com' - -config.gem 'mislav-will_paginate', - :lib => 'will_paginate', - :source => 'http://gems.github.com' - -config.gem 'mini_magick', - :lib => 'mini_magick' - -config.gem 'thoughtbot-paperclip', - :lib => 'paperclip', - :source => 'http://gems.github.com', - :version => '~>2.3.1' - -config.gem 'norman-friendly_id', - :lib => 'friendly_id', - :source => 'http://gems.github.com' - -config.gem 'daemons' - -$:.unshift "#{File.dirname(__FILE__)}/lib" -require 'active_record/acts/list' -ActiveRecord::Base.class_eval { include ActiveRecord::Acts::List } - -config.to_prepare do - # Use JSON gem as ActiveSupport::JSON backend - ActiveSupport::JSON.backend = 'JSONGem' - - # Include VrameHelper - ApplicationController.helper(VrameHelper) - - # Include Vrame::Base into ApplicationController - ApplicationController.class_eval do - include(Vrame::Base) - end - - # Configure nine_auth_engine - NineAuthEngine.configure do |config| - config.after_signup_redirect = '/signin/' - config.after_signin_redirect = '/vrame/' - config.after_signout_redirect = '/signin/' - config.after_password_reset_redirect = '/signin/' - config.after_password_update_redirect = '/vrame/' - config.after_signup_disabled_redirect = '/signin/' - config.disable_signup = true - config.layout("vrame") - end -end - -unless File.exist?(File.join(RAILS_ROOT, 'public', "vrame")) || ['vrame:sync', 'vrame:bootstrap', 'gems:install'].include?(ARGV[0]) - puts "\033[31m" - puts "Please run rake vrame:sync before continuing" - puts "\033[36m" - puts "rake vrame:sync" - puts "\033[0m" - raise "VRAME Bootstrap Error" -end \ No newline at end of file diff --git a/install.rb b/install.rb deleted file mode 100644 index f7732d3..0000000 --- a/install.rb +++ /dev/null @@ -1 +0,0 @@ -# Install hook code here diff --git a/lib/active_record/acts/list.rb b/lib/active_record/acts/list.rb deleted file mode 100644 index 1bb91c6..0000000 --- a/lib/active_record/acts/list.rb +++ /dev/null @@ -1,256 +0,0 @@ -module ActiveRecord - module Acts #:nodoc: - module List #:nodoc: - def self.included(base) - base.extend(ClassMethods) - end - - # This +acts_as+ extension provides the capabilities for sorting and reordering a number of objects in a list. - # The class that has this specified needs to have a +position+ column defined as an integer on - # the mapped database table. - # - # Todo list example: - # - # class TodoList < ActiveRecord::Base - # has_many :todo_items, :order => "position" - # end - # - # class TodoItem < ActiveRecord::Base - # belongs_to :todo_list - # acts_as_list :scope => :todo_list - # end - # - # todo_list.first.move_to_bottom - # todo_list.last.move_higher - module ClassMethods - # Configuration options are: - # - # * +column+ - specifies the column name to use for keeping the position integer (default: +position+) - # * +scope+ - restricts what is to be considered a list. Given a symbol, it'll attach _id - # (if it hasn't already been added) and use that as the foreign key restriction. It's also possible - # to give it an entire string that is interpolated if you need a tighter scope than just a foreign key. - # Example: acts_as_list :scope => 'todo_list_id = #{todo_list_id} AND completed = 0' - def acts_as_list(options = {}) - configuration = { :column => "position", :scope => "1 = 1" } - configuration.update(options) if options.is_a?(Hash) - - configuration[:scope] = "#{configuration[:scope]}_id".intern if configuration[:scope].is_a?(Symbol) && configuration[:scope].to_s !~ /_id$/ - - if configuration[:scope].is_a?(Symbol) - scope_condition_method = %( - def scope_condition - if #{configuration[:scope].to_s}.nil? - "#{configuration[:scope].to_s} IS NULL" - else - "#{configuration[:scope].to_s} = \#{#{configuration[:scope].to_s}}" - end - end - ) - else - scope_condition_method = "def scope_condition() \"#{configuration[:scope]}\" end" - end - - class_eval <<-EOV - include ActiveRecord::Acts::List::InstanceMethods - - def acts_as_list_class - ::#{self.name} - end - - def position_column - '#{configuration[:column]}' - end - - #{scope_condition_method} - - before_destroy :remove_from_list - before_create :add_to_list_bottom - EOV - end - end - - # All the methods available to a record that has had acts_as_list specified. Each method works - # by assuming the object to be the item in the list, so chapter.move_lower would move that chapter - # lower in the list of all chapters. Likewise, chapter.first? would return +true+ if that chapter is - # the first in the list of all chapters. - module InstanceMethods - # Insert the item at the given position (defaults to the top position of 1). - def insert_at(position = 1) - insert_at_position(position) - end - - # Swap positions with the next lower item, if one exists. - def move_lower - return unless lower_item - - acts_as_list_class.transaction do - lower_item.decrement_position - increment_position - end - end - - # Swap positions with the next higher item, if one exists. - def move_higher - return unless higher_item - - acts_as_list_class.transaction do - higher_item.increment_position - decrement_position - end - end - - # Move to the bottom of the list. If the item is already in the list, the items below it have their - # position adjusted accordingly. - def move_to_bottom - return unless in_list? - acts_as_list_class.transaction do - decrement_positions_on_lower_items - assume_bottom_position - end - end - - # Move to the top of the list. If the item is already in the list, the items above it have their - # position adjusted accordingly. - def move_to_top - return unless in_list? - acts_as_list_class.transaction do - increment_positions_on_higher_items - assume_top_position - end - end - - # Removes the item from the list. - def remove_from_list - if in_list? - decrement_positions_on_lower_items - update_attribute position_column, nil - end - end - - # Increase the position of this item without adjusting the rest of the list. - def increment_position - return unless in_list? - update_attribute position_column, self.send(position_column).to_i + 1 - end - - # Decrease the position of this item without adjusting the rest of the list. - def decrement_position - return unless in_list? - update_attribute position_column, self.send(position_column).to_i - 1 - end - - # Return +true+ if this object is the first in the list. - def first? - return false unless in_list? - self.send(position_column) == 1 - end - - # Return +true+ if this object is the last in the list. - def last? - return false unless in_list? - self.send(position_column) == bottom_position_in_list - end - - # Return the next higher item in the list. - def higher_item - return nil unless in_list? - acts_as_list_class.find(:first, :conditions => - "#{scope_condition} AND #{position_column} < #{send(position_column).to_s}", :order => "#{acts_as_list_class.table_name}.#{position_column} DESC" - ) - end - - # Return the next lower item in the list. - def lower_item - return nil unless in_list? - acts_as_list_class.find(:first, :conditions => - "#{scope_condition} AND #{position_column} > #{send(position_column).to_s}", :order => "#{acts_as_list_class.table_name}.#{position_column} ASC" - ) - end - - # Test if this record is in a list - def in_list? - !send(position_column).nil? - end - - private - def add_to_list_top - increment_positions_on_all_items - end - - def add_to_list_bottom - self[position_column] = bottom_position_in_list.to_i + 1 - end - - # Overwrite this method to define the scope of the list changes - def scope_condition() "1" end - - # Returns the bottom position number in the list. - # bottom_position_in_list # => 2 - def bottom_position_in_list(except = nil) - item = bottom_item(except) - item ? item.send(position_column) : 0 - end - - # Returns the bottom item - def bottom_item(except = nil) - conditions = scope_condition - conditions = "#{conditions} AND #{self.class.primary_key} != #{except.id}" if except - acts_as_list_class.find(:first, :conditions => conditions, :order => "#{position_column} DESC") - end - - # Forces item to assume the bottom position in the list. - def assume_bottom_position - update_attribute(position_column, bottom_position_in_list(self).to_i + 1) - end - - # Forces item to assume the top position in the list. - def assume_top_position - update_attribute(position_column, 1) - end - - # This has the effect of moving all the higher items up one. - def decrement_positions_on_higher_items(position) - acts_as_list_class.update_all( - "#{position_column} = (#{position_column} - 1)", "#{scope_condition} AND #{position_column} <= #{position}" - ) - end - - # This has the effect of moving all the lower items up one. - def decrement_positions_on_lower_items - return unless in_list? - acts_as_list_class.update_all( - "#{position_column} = (#{position_column} - 1)", "#{scope_condition} AND #{position_column} > #{send(position_column).to_i}" - ) - end - - # This has the effect of moving all the higher items down one. - def increment_positions_on_higher_items - return unless in_list? - acts_as_list_class.update_all( - "#{position_column} = (#{position_column} + 1)", "#{scope_condition} AND #{position_column} < #{send(position_column).to_i}" - ) - end - - # This has the effect of moving all the lower items down one. - def increment_positions_on_lower_items(position) - acts_as_list_class.update_all( - "#{position_column} = (#{position_column} + 1)", "#{scope_condition} AND #{position_column} >= #{position}" - ) - end - - # Increments position (position_column) of all items in the list. - def increment_positions_on_all_items - acts_as_list_class.update_all( - "#{position_column} = (#{position_column} + 1)", "#{scope_condition}" - ) - end - - def insert_at_position(position) - remove_from_list - increment_positions_on_lower_items(position) - self.update_attribute(position_column, position) - end - end - end - end -end \ No newline at end of file diff --git a/lib/jsonobject.rb b/lib/jsonobject.rb deleted file mode 100644 index add3f81..0000000 --- a/lib/jsonobject.rb +++ /dev/null @@ -1,116 +0,0 @@ -require 'ostruct' -require 'jsonobject/helper' -require 'jsonobject/schema' -require 'jsonobject/store' -require 'jsonobject/type' -require 'jsonobject/types' - -module JsonObject # @TODO rename JsonObjectExtension, this is not an object! - - class InvalidSchemaPath < RuntimeError - #TODO More descriptive - end - - class << self - def included base - base.extend(ClassMethods) - end - end - - module ClassMethods - def has_json_schema(name, options = {}) - include InstanceMethods - - json_schema_options[name] = options - - define_method name do |*args| - json_schema_for(name) - end - - define_method "#{name}=" do |hash| - json_schema_for(name).update(hash) - end - - before_save do |instance| - instance["#{name}_json"] = instance.json_schema_for(name).to_json - end - end - - def has_json_store(name, options = {}) - include InstanceMethods - - raise InvalidSchemaPath unless options.has_key?(:schema) - - json_store_options[name] = options - - define_method name do |*args| - json_store_for(name) - end - - define_method "#{name}=" do |hash| - json_store_for(name).update(hash) - end - - before_save do |instance| - instance["#{name}_json"] = instance.json_store_for(name).to_json - end - end - - def json_schema_options - if read_inheritable_attribute(:json_schema_options).nil? - write_inheritable_attribute(:json_schema_options, {}) - end - read_inheritable_attribute(:json_schema_options) - end - - def json_store_options - if read_inheritable_attribute(:json_store_options).nil? - write_inheritable_attribute(:json_store_options, {}) - end - read_inheritable_attribute(:json_store_options) - end - end - - module InstanceMethods - - def json_schemas - @json_schemas ||= {} - end - - def json_stores - @json_stores ||= {} - end - - def json_schema_for(name) - json_schemas[name] ||= initialize_schema(name, self.class.json_schema_options[name]) - end - - def json_store_for(name) - json_stores[name] ||= initialize_store(name, self.class.json_store_options[name][:schema]) - end - - private - - def initialize_schema(name, options) - json = self["#{name}_json"] - Schema.load_from_json_with_options(json, options) - end - - def initialize_store(name, schema_path) - json = self["#{name}_json"] - schema = schema_from_path(schema_path) - Store.load_from_json_with_schema(json, schema) - end - - def schema_from_path(schema_path) - schema_path = [schema_path].flatten - raise InvalidSchemaPath if schema_path.compact.empty? - schema = schema_path.inject(self) { |current, attr| current.send(attr) } - schema or raise JsonObject::SchemaNotFound, "Schema_path #{schema_path.join('.')} does not lead to a schema" - end - end -end - -if Object.const_defined?("ActiveRecord") - ActiveRecord::Base.send(:include, JsonObject) -end \ No newline at end of file diff --git a/lib/jsonobject/helper.rb b/lib/jsonobject/helper.rb deleted file mode 100644 index 6faeb9c..0000000 --- a/lib/jsonobject/helper.rb +++ /dev/null @@ -1,22 +0,0 @@ -module JsonObject - module Helper - UMLAUTS = {"ä" => "ae", - "ö" => "oe", - "ü" => "ue", - "ß" => "ss"} - - def self.dehumanize(human_string) - # @TODO: - if first char is a number, append an underscore - # - collisions might occur - # - replace invalid characters - out = human_string.mb_chars - out.downcase! - out.strip! - out.gsub!(/[\!\@\#\$\%\^\&\*\(\)\=\+\. -]+/,'_') - UMLAUTS.each do |umlaut, subst| - out.gsub!(umlaut, subst) - end - out.to_s - end - end -end \ No newline at end of file diff --git a/lib/jsonobject/schema.rb b/lib/jsonobject/schema.rb deleted file mode 100644 index 3c66efe..0000000 --- a/lib/jsonobject/schema.rb +++ /dev/null @@ -1,146 +0,0 @@ -module JsonObject - class UnknownSchemaAttributeError < NoMethodError - end - - class UnknownAssociationError < ActiveRecord::ActiveRecordError - end - - class Schema - attr_reader :fields, :errors - - def initialize(options = {}) - @options = Schema.default_options.merge(options) - @fields = [] - end - - def self.load_from_json_with_options(json, options = {}) - return Schema.new(options) if json.blank? - - schema = JSON.parse(json) - if schema.is_a? Schema - schema.instance_variable_set(:@options, Schema.default_options.merge(options)) - else - schema = Schema.new(options) - end - schema - end - - def update(array) - updated_uids = [] - for field_hash in array - field_hash = field_hash.dup - klass = field_hash.delete("type").constantize #TODO Security check, only constantize safe classes - field_is_new = field_hash['uid'].blank? - if field_is_new - field = klass.new(field_hash) - updated_uids << field.uid - @fields << field - else - updated_uids << field_hash['uid'] - field = field_by_uid(field_hash.delete('uid')) - field.update_attributes(field_hash) - end - end - - remove_fields_by_uids(updated_uids) - end - - # Remove all fields with uids that are not in the submitted list - def remove_fields_by_uids(uids) - @fields.reject! {|field| !uids.include?(field.uid)} - end - - def to_json(*args) - { :json_class => "JsonObject::Schema", - :fields => @fields }.to_json(*args) - end - - def self.json_create(object) - schema = self.allocate - schema.instance_variable_set(:@fields, object['fields']) - schema - end - - def field_for(name) - field = @fields.find{|f| f.name == name} - raise UnknownSchemaAttributeError.new("Attribute named '#{name}' not in store schema") if field.nil? - field - end - - def [](name) - field_for(name) - end - - def has_field?(name) - !!@fields.find{|f| f.name == name} - end - - def field_by_uid(uid) - field = @fields.find{|f| f.uid == uid} - raise UnknownSchemaAttributeError.new("Attribute with UID '#{uid}' not in store schema") if field.nil? - field - end - - def valid? - @errors = [] - names = [] - uids = [] - - # validate fields - fields.each do |field| - @errors << [field.name, [:name, "is already in use"]] if names.include?(field.name) - @errors << [field.name, [:uid, "is already in use"]] if uids.include?(field.uid) - names << field.name - uids << field.uid - @errors << [field.name, field.errors] unless field.valid? - end - - @errors.empty? - end - - def each_field(&block) - @fields.each(block) - end - - def self.default_options - @@default_options ||= { :allowed_types => [ - 'JsonObject::Types::Asset', - 'JsonObject::Types::Collection', - 'JsonObject::Types::String', - 'JsonObject::Types::Text', - 'JsonObject::Types::Date', - 'JsonObject::Types::Time', - 'JsonObject::Types::DateTime', - 'JsonObject::Types::Select', - 'JsonObject::Types::Multiselect' - ]} - end - - def class_for_type(t) - t.constantize if @options[:allowed_types].include? t - end - - # Return a copy of this schema, but with different uuids - # - # User this on the command line to duplicate Categories' schemas. - def copy - old_schema = self - new_schema = Schema.new - for field in old_schema.fields - new_schema.fields << field.copy - end - new_schema - end - - private - - def initialize_fields - @fields = {} - if @hash['fields'].is_a? Array - @hash['fields'].each { |type| @fields[type.name] = type } - end - end - - end - -end \ No newline at end of file diff --git a/lib/jsonobject/store.rb b/lib/jsonobject/store.rb deleted file mode 100644 index 6503425..0000000 --- a/lib/jsonobject/store.rb +++ /dev/null @@ -1,103 +0,0 @@ -module JsonObject - class SchemaNotFoundError < RuntimeError - end - - class Store - attr_reader :errors - - def initialize(options = {}) - @values = {} - @schema = options[:schema] if options[:schema] - raise SchemaNotFoundError, "Can't initialize a Store without a schema" unless schema.is_a? Schema - end - - def self.load_from_json_with_schema(json, schema) - raise SchemaNotFoundError, "Can't initialize a Store without a schema" unless schema.is_a?(Schema) - - return self.new(:schema => schema) if json.blank? - - store = JSON.parse(json) - if store.is_a? Store - store.instance_variable_set(:@schema, schema) - else - store = self.new(:schema => schema) - end - store - end - - def schema - raise SchemaNotFoundError unless @schema.is_a?(JsonObject::Schema) - @schema - end - - def update(hash) - hash.each_pair do |uid, value| - write_value_by_uid(uid, value) - end - end - - def valid? - @errors = [] - @schema.fields.each do |field| - @errors << [field.name, field.value_errors] unless field.value_valid?(@values[field.uid]) - end - @errors.empty? - end - - def method_missing(name, value=nil) - name = name.to_s - if name[-1,1] == '=' - write_value(name.chop, value) - else - read_value(name) - end - end - - def [](name) - read_value(name) - end - - def []=(name, value) - write_value(name.to_s, value) - end - - def to_json(*args) - {:json_class => self.class.name, - :values => @values}.to_json(*args) - end - - def self.json_create(object) - store = self.allocate - store.instance_variable_set(:@values, object['values']) - store - end - - private - - def read_value(name) - field = @schema.field_for(name) - field.object_from_value(@values[field.uid]) - end - - def write_value(name, value) - name, value = normalize_access_to_object(name, value) - field = @schema.field_for(name) - @values[field.uid] = field.value_from_param(value) - end - - def write_value_by_uid(uid, value) - uid, value = normalize_access_to_object(uid, value) - field = @schema.field_by_uid(uid) - @values[field.uid] = field.value_from_param(value) - end - - def normalize_access_to_object(name,value) - if name =~ /(.*)_json$/ - name = $1 - value = JSON.parse(value) - end - [name, value] - end - - end -end \ No newline at end of file diff --git a/lib/jsonobject/type.rb b/lib/jsonobject/type.rb deleted file mode 100644 index f9c2227..0000000 --- a/lib/jsonobject/type.rb +++ /dev/null @@ -1,121 +0,0 @@ -module JsonObject - # A Type - # - # - Determines the look of the category editor for its field - # - Determines how the data from the category editor are stored in the schema - # - Validates Fields - # - Prevents use of reserved keywords - # - Prevents use of duplicate names - # - Prevents illegal configuration of types - # - # The Type's configuration data from the schema is used to form an instance of - # the type. This instance - # - Validates data entered in the document editor - # - Determines the look of the document editor - # - Determines how the params hash from the editor is converted to a Ruby data structure - # - Determines how that Ruby data strucute is serialized/deserialized - # Type.serialize(ruby object) => Primitivobjekt - # Type.deserialize(primitivobjekt) => Ruby Object - class Type - RESERVED_KEYWORDS = Object.new.methods - UNSERIALIZABLE_PROPERTIES = ['@errors', '@value_errors'] - - attr_accessor :name, :description, :title, :required, :uid - attr_reader :errors - - def initialize(params={}) - update_attributes(params) - self.uid = generate_uid if self.uid.blank? - self.name = self.title if self.name.blank? && !self.title.blank? - end - - def generate_uid - # @TODO Only works with MySQL - # rand to prevent mysql caching - ActiveRecord::Base.connection.select_value(%Q(SELECT UUID() as "#{rand}")) - end - - def valid? - @errors = [] - validate_base - validate if self.respond_to?(:validate) - @errors.empty? - end - - def title=(t) - @title = t - self.name = t if name.blank? - end - - def name=(n) - @name = JsonObject::Helper.dehumanize(n) - end - - def required=(r) - @required = [true, "true", 1, "1"].include?(r) - end - - def to_json(*args) - hash = {} - self.instance_variables.each do |attr| - next if UNSERIALIZABLE_PROPERTIES.include?(attr) - hash[attr[1..-1]] = self.instance_variable_get(attr) - end - hash[:json_class] = self.class.name - hash.to_json(*args) - end - - def self.json_create(object) - type = self.allocate - object.delete("json_class") - type.update_attributes(object) - type - end - - # Return a copy of this type, but with a different uuid - def copy - new_type = JSON.parse(self.to_json) - new_type.uid = generate_uid - new_type - end - - def update_attributes(hash) - hash.each do |key, value| - self.instance_variable_set("@#{key}", value) - end - self.required = @required - end - - # Convert the content of the param to the values that gets stored in the JSON Store - def value_from_param(param) - param - end - - # Convert the value stored in the JSON Store to a Ruby object - def object_from_value(val) - val - end - - def value_valid?(v) - @value_errors = [] - validate_value_base(v) - validate_value(v) if self.respond_to?(:validate_value) - @value_errors.empty? - end - - attr_reader :value_errors - - private - - def validate_value_base(v) - @value_errors << ["is required and can not be blank"] if v.blank? && required - end - - def validate_base - @errors << [:name, "darf nicht leer sein"] if name.blank? - @errors << [:name, "darf nicht auf _json enden"] if name =~ /_json$/ - @errors << [:name, "darf kein reserviertes Wort sein"] if RESERVED_KEYWORDS.include?(name) - @errors << [:name, "darf nicht mit einer Zahl beginnen"] if name =~ /^\d/ - end - end -end \ No newline at end of file diff --git a/lib/jsonobject/types.rb b/lib/jsonobject/types.rb deleted file mode 100644 index 54131a6..0000000 --- a/lib/jsonobject/types.rb +++ /dev/null @@ -1,14 +0,0 @@ -module JsonObject - module Types - end -end - -require 'jsonobject/types/string' -require 'jsonobject/types/text' -require 'jsonobject/types/select' -require 'jsonobject/types/multi_select' -require 'jsonobject/types/datetime' -require 'jsonobject/types/bool' -require 'jsonobject/types/asset' -require 'jsonobject/types/collection' -require 'jsonobject/types/placemark' diff --git a/lib/jsonobject/types/asset.rb b/lib/jsonobject/types/asset.rb deleted file mode 100644 index 4e94fcd..0000000 --- a/lib/jsonobject/types/asset.rb +++ /dev/null @@ -1,39 +0,0 @@ -module JsonObject - module Types - class Asset < JsonObject::Type - attr_accessor :styles - - def styles=(s) - raise TypeError, "styles for Asset has to be an array" unless s.is_a? Array - s.each do |e| - e['key'] = e['key'].to_s.strip - e['style'] = e['style'].to_s.strip - end - @styles = s.reject {|e| e['style'].blank? || e['key'].blank? } - end - - def object_from_value(val) - ::Asset.find_by_id(val.to_i) - end - - def self.styles_for(schema_params) - klass = schema_params[:class].constantize # @TODO Security check - id = schema_params[:id] - attribute = schema_params[:attribute] - uid = schema_params[:uid] - # @TODO Catch errors - - schema = klass.find(id).send(attribute) - raise "Schema #{attrib} not found in #{klass.name} #{id}" unless schema - field = schema.field_by_uid(uid) - raise "Field #{uid} not found in #{klass.name} #{id}, schema #{attrib}" unless field - styles = {} - (field.styles || {}).each do |s| - styles[s['key']] = s['style'] - end - styles - end - - end - end -end \ No newline at end of file diff --git a/lib/jsonobject/types/bool.rb b/lib/jsonobject/types/bool.rb deleted file mode 100644 index 03f062a..0000000 --- a/lib/jsonobject/types/bool.rb +++ /dev/null @@ -1,13 +0,0 @@ -module JsonObject - module Types - class Bool < JsonObject::Type - def value_from_param(boolish) - [true, "true", 1, "1"].include?(boolish) - end - - def object_from_value(val) - [true, "true", 1, "1"].include?(val) - end - end - end -end \ No newline at end of file diff --git a/lib/jsonobject/types/collection.rb b/lib/jsonobject/types/collection.rb deleted file mode 100644 index da237b4..0000000 --- a/lib/jsonobject/types/collection.rb +++ /dev/null @@ -1,20 +0,0 @@ -module JsonObject - module Types - class Collection < JsonObject::Type - attr_accessor :styles - - def styles=(s) - raise TypeError, "styles for Collection has to be an array" unless s.is_a? Array - s.each do |e| - e['key'] = e['key'].to_s.strip - e['style'] = e['style'].to_s.strip - end - @styles = s.reject {|e| e['style'].blank? || e['key'].blank? } - end - - def object_from_value(val) - ::Collection.find_by_id(val.to_i) - end - end - end -end \ No newline at end of file diff --git a/lib/jsonobject/types/datetime.rb b/lib/jsonobject/types/datetime.rb deleted file mode 100644 index d0d1c80..0000000 --- a/lib/jsonobject/types/datetime.rb +++ /dev/null @@ -1,6 +0,0 @@ -module JsonObject - module Types - class Datetime < JsonObject::Type - end - end -end \ No newline at end of file diff --git a/lib/jsonobject/types/multi_select.rb b/lib/jsonobject/types/multi_select.rb deleted file mode 100644 index a885ee7..0000000 --- a/lib/jsonobject/types/multi_select.rb +++ /dev/null @@ -1,9 +0,0 @@ -module JsonObject - module Types - class MultiSelect < Select - def validate_value(values) - @value_errors << "'#{values}' is not a subset of the list of valid options" unless values&options==values - end - end - end -end \ No newline at end of file diff --git a/lib/jsonobject/types/placemark.rb b/lib/jsonobject/types/placemark.rb deleted file mode 100644 index 1578c44..0000000 --- a/lib/jsonobject/types/placemark.rb +++ /dev/null @@ -1,6 +0,0 @@ -module JsonObject - module Types - class Placemark < JsonObject::Type - end - end -end \ No newline at end of file diff --git a/lib/jsonobject/types/select.rb b/lib/jsonobject/types/select.rb deleted file mode 100644 index b57a606..0000000 --- a/lib/jsonobject/types/select.rb +++ /dev/null @@ -1,22 +0,0 @@ -module JsonObject - module Types - class Select < JsonObject::Type - attr_accessor :options - def options=(o) - raise TypeError, "options for Select has to be an array of strings" unless o.is_a? Array - o.map!{|e| e.to_s.strip} - @options = o.reject {|e| e.blank?} - end - - def validate - if !@options.is_a?(Array) || @options.length < 2 - @errors << [:options, "müssen mindestens zwei Elemente enthalten"] - end - end - - def validate_value(value) - @value_errors << "'#{value}' is not included in the list of valid options" unless options.include?(value) - end - end - end -end \ No newline at end of file diff --git a/lib/jsonobject/types/string.rb b/lib/jsonobject/types/string.rb deleted file mode 100644 index 86a9d38..0000000 --- a/lib/jsonobject/types/string.rb +++ /dev/null @@ -1,6 +0,0 @@ -module JsonObject - module Types - class String < JsonObject::Type - end - end -end \ No newline at end of file diff --git a/lib/jsonobject/types/text.rb b/lib/jsonobject/types/text.rb deleted file mode 100644 index 917f5cc..0000000 --- a/lib/jsonobject/types/text.rb +++ /dev/null @@ -1,6 +0,0 @@ -module JsonObject - module Types - class Text < JsonObject::Type - end - end -end \ No newline at end of file diff --git a/lib/paperclip_filetypes.rb b/lib/paperclip_filetypes.rb deleted file mode 100644 index 793f73e..0000000 --- a/lib/paperclip_filetypes.rb +++ /dev/null @@ -1,23 +0,0 @@ -module Paperclip - class Attachment - ImageFileExtensions = %w(jpg png gif) - MovieFileExtensions = %w(flv m4v) - - def self.is_image? (filename) - ImageFileExtensions.include?(File.extname(filename)[1..-1].downcase) - end - - def is_image? () - ImageFileExtensions.include?(File.extname(original_filename)[1..-1].downcase) - end - - def self.is_movie? (filename) - MovieFileExtensions.include?(File.extname(filename)[1..-1].downcase) - end - - def is_movie? () - MovieFileExtensions.include?(File.extname(original_filename)[1..-1].downcase) - end - - end -end \ No newline at end of file diff --git a/lib/tasks/vrame.rake b/lib/tasks/vrame.rake deleted file mode 100644 index f3cf271..0000000 --- a/lib/tasks/vrame.rake +++ /dev/null @@ -1,59 +0,0 @@ -task "db:migrate" => ["vrame:sync", "nine_auth_engine:sync"] - -namespace :vrame do - desc "Bootstrap VRAME by creating an admin user and German and English as languages" - task :bootstrap => [:environment, "vrame:sync", "nine_auth_engine:sync", "db:migrate" ] do - - unless Language.find_by_iso2_code('de') - puts "Adding German language" - german = Language.create!( :name => 'Deutsch', :iso2_code => 'de', :published => true ) - end - - unless Language.find_by_iso2_code('en') - puts "Adding English language" - english = Language.create!( :name => 'English', :iso2_code => 'en', :published => true ) - end - - unless User.find_by_email('vrame@9elements.com') - puts "Creating admin user vrame" - u = User.create!( :email => 'vrame@example.com', :password => 'vrame', :password_confirmation => 'vrame', :admin => true ) - end - - puts - puts "1) Start your server (e.g. via script/server)" - puts "2) Open http://localhost:3000/vrame and login with user: vrame@example.com, password: vrame" - puts - - end - - desc "Synchronize VRAME's assets and migrations with the root application's" - task :sync => :environment do - require 'fileutils' - - # Assets - vrame_assets = File.join(RAILS_ROOT, 'vendor', 'plugins', 'vrame', 'public', 'vrame') - public_sync_target = File.join(RAILS_ROOT, 'public', 'vrame') - - # Migrations - vrame_migrations = File.join(RAILS_ROOT, 'vendor', 'plugins', 'vrame', 'db', 'migrate', '.') - migrations_sync_target = File.join(RAILS_ROOT, 'db', 'migrate') - - # Delete the public sync target if it already exists - if File.directory?(public_sync_target) - puts "Removing existing public/vrame" - FileUtils.rm_r(public_sync_target, :force => true) - end - - # Copy vrame assets to public sync target - puts "Copying plugin assets to public/vrame" - FileUtils.cp_r(vrame_assets, public_sync_target) - - # Create empty vrame_specific.css if necessary - vrame_specific_css = File.join(RAILS_ROOT, 'public', 'stylesheets', 'vrame_specific.css') - File.new(vrame_specific_css, 'w').close unless File.exists?(vrame_specific_css) - - # Copy DB migrations - puts "Copying migrations to db/migrate" - FileUtils.cp_r(vrame_migrations, migrations_sync_target) - end -end \ No newline at end of file diff --git a/lib/vrame.rb b/lib/vrame.rb deleted file mode 100644 index 831392b..0000000 --- a/lib/vrame.rb +++ /dev/null @@ -1,69 +0,0 @@ -module Vrame - class NoLanguageInDatabaseError < RuntimeError; end - - class << self - # The Configuration instance used to configure the NineAuthEngine - def configuration - @@configuration ||= Configuration.new - end - - def configuration=(configuration) - @@configuration = configuration - end - - def configure - yield Vrame.configuration if block_given? - end - end - - module Base - def self.included(controller) - controller.send(:include, InstanceMethods) - - controller.class_eval do - include NineAuthEngine::Authentication - - helper VrameHelper - helper_method :current_language - - before_filter :select_language, :except => :switch_language - end - end - - module InstanceMethods - def current_language - @current_language - end - - def select_language - if session[:vrame_frontend_language_id] - @current_language = Language.find(session[:vrame_frontend_language_id]) - else - @current_language = Language.all.first - end - - raise NoLanguageInDatabaseError, "You have to add a language to the database" if @current_language.nil? - session[:vrame_frontend_language_id] = @current_language.id - I18n.locale = @current_language.iso2_code - - true - end - - def switch_language - @current_language = Language.find(params[:id]) - session[:vrame_frontend_language_id] = @current_language.id - redirect_to root_path - end - end # /InstanceMethods - end # /Base - - class Configuration - attr_accessor :image_styles, :posterframe_styles - - def initialize() - self.image_styles = HashWithIndifferentAccess.new - self.posterframe_styles = HashWithIndifferentAccess.new - end - end - -end \ No newline at end of file diff --git a/public/vrame/images/admin/add.png b/public/vrame/images/admin/add.png deleted file mode 100644 index 5997ad7..0000000 Binary files a/public/vrame/images/admin/add.png and /dev/null differ diff --git a/public/vrame/images/admin/ajax-loading-black.gif b/public/vrame/images/admin/ajax-loading-black.gif deleted file mode 100644 index 27df81f..0000000 Binary files a/public/vrame/images/admin/ajax-loading-black.gif and /dev/null differ diff --git a/public/vrame/images/admin/ajax-loading-white.gif b/public/vrame/images/admin/ajax-loading-white.gif deleted file mode 100644 index d42f72c..0000000 Binary files a/public/vrame/images/admin/ajax-loading-white.gif and /dev/null differ diff --git a/public/vrame/images/admin/arrow_down.png b/public/vrame/images/admin/arrow_down.png deleted file mode 100644 index 8a31f8c..0000000 Binary files a/public/vrame/images/admin/arrow_down.png and /dev/null differ diff --git a/public/vrame/images/admin/arrow_right.png b/public/vrame/images/admin/arrow_right.png deleted file mode 100644 index 0586602..0000000 Binary files a/public/vrame/images/admin/arrow_right.png and /dev/null differ diff --git a/public/vrame/images/admin/arrow_up.png b/public/vrame/images/admin/arrow_up.png deleted file mode 100644 index e2b0d48..0000000 Binary files a/public/vrame/images/admin/arrow_up.png and /dev/null differ diff --git a/public/vrame/images/admin/child.png b/public/vrame/images/admin/child.png deleted file mode 100644 index 304f656..0000000 Binary files a/public/vrame/images/admin/child.png and /dev/null differ diff --git a/public/vrame/images/admin/delete.png b/public/vrame/images/admin/delete.png deleted file mode 100644 index 1a37f7e..0000000 Binary files a/public/vrame/images/admin/delete.png and /dev/null differ diff --git a/public/vrame/images/admin/edit.png b/public/vrame/images/admin/edit.png deleted file mode 100644 index ecc78b9..0000000 Binary files a/public/vrame/images/admin/edit.png and /dev/null differ diff --git a/public/vrame/images/admin/email_go.png b/public/vrame/images/admin/email_go.png deleted file mode 100644 index aff2c47..0000000 Binary files a/public/vrame/images/admin/email_go.png and /dev/null differ diff --git a/public/vrame/images/admin/eye.png b/public/vrame/images/admin/eye.png deleted file mode 100644 index ab5a471..0000000 Binary files a/public/vrame/images/admin/eye.png and /dev/null differ diff --git a/public/vrame/images/admin/folder.png b/public/vrame/images/admin/folder.png deleted file mode 100644 index 44f67fa..0000000 Binary files a/public/vrame/images/admin/folder.png and /dev/null differ diff --git a/public/vrame/images/admin/folder_explore.png b/public/vrame/images/admin/folder_explore.png deleted file mode 100644 index 43cc4ee..0000000 Binary files a/public/vrame/images/admin/folder_explore.png and /dev/null differ diff --git a/public/vrame/images/admin/group_go.png b/public/vrame/images/admin/group_go.png deleted file mode 100644 index 3cafd04..0000000 Binary files a/public/vrame/images/admin/group_go.png and /dev/null differ diff --git a/public/vrame/images/admin/led-green.png b/public/vrame/images/admin/led-green.png deleted file mode 100644 index 1c6acc3..0000000 Binary files a/public/vrame/images/admin/led-green.png and /dev/null differ diff --git a/public/vrame/images/admin/led-red.png b/public/vrame/images/admin/led-red.png deleted file mode 100644 index aec1846..0000000 Binary files a/public/vrame/images/admin/led-red.png and /dev/null differ diff --git a/public/vrame/images/admin/led-yellow.png b/public/vrame/images/admin/led-yellow.png deleted file mode 100644 index 81a4672..0000000 Binary files a/public/vrame/images/admin/led-yellow.png and /dev/null differ diff --git a/public/vrame/images/admin/magnifier.png b/public/vrame/images/admin/magnifier.png deleted file mode 100644 index f014a26..0000000 Binary files a/public/vrame/images/admin/magnifier.png and /dev/null differ diff --git a/public/vrame/images/admin/page.png b/public/vrame/images/admin/page.png deleted file mode 100644 index b1b7ebe..0000000 Binary files a/public/vrame/images/admin/page.png and /dev/null differ diff --git a/public/vrame/images/admin/page_add.png b/public/vrame/images/admin/page_add.png deleted file mode 100644 index 7f8ac96..0000000 Binary files a/public/vrame/images/admin/page_add.png and /dev/null differ diff --git a/public/vrame/images/admin/page_delete.png b/public/vrame/images/admin/page_delete.png deleted file mode 100644 index d0136a1..0000000 Binary files a/public/vrame/images/admin/page_delete.png and /dev/null differ diff --git a/public/vrame/images/admin/page_edit.png b/public/vrame/images/admin/page_edit.png deleted file mode 100644 index d3ac951..0000000 Binary files a/public/vrame/images/admin/page_edit.png and /dev/null differ diff --git a/public/vrame/images/admin/page_white.png b/public/vrame/images/admin/page_white.png deleted file mode 100644 index 3524eac..0000000 Binary files a/public/vrame/images/admin/page_white.png and /dev/null differ diff --git a/public/vrame/images/admin/page_white_add.png b/public/vrame/images/admin/page_white_add.png deleted file mode 100644 index d7369a3..0000000 Binary files a/public/vrame/images/admin/page_white_add.png and /dev/null differ diff --git a/public/vrame/images/admin/page_white_delete.png b/public/vrame/images/admin/page_white_delete.png deleted file mode 100644 index 3285fed..0000000 Binary files a/public/vrame/images/admin/page_white_delete.png and /dev/null differ diff --git a/public/vrame/images/admin/page_white_edit.png b/public/vrame/images/admin/page_white_edit.png deleted file mode 100644 index 9e4e2b6..0000000 Binary files a/public/vrame/images/admin/page_white_edit.png and /dev/null differ diff --git a/public/vrame/images/admin/pencil.png b/public/vrame/images/admin/pencil.png deleted file mode 100644 index 24546c7..0000000 Binary files a/public/vrame/images/admin/pencil.png and /dev/null differ diff --git a/public/vrame/images/admin/time.png b/public/vrame/images/admin/time.png deleted file mode 100644 index a286372..0000000 Binary files a/public/vrame/images/admin/time.png and /dev/null differ diff --git a/public/vrame/images/admin/upload_button.png b/public/vrame/images/admin/upload_button.png deleted file mode 100644 index 57fd50c..0000000 Binary files a/public/vrame/images/admin/upload_button.png and /dev/null differ diff --git a/public/vrame/images/rte/bold.gif b/public/vrame/images/rte/bold.gif deleted file mode 100644 index b385eea..0000000 Binary files a/public/vrame/images/rte/bold.gif and /dev/null differ diff --git a/public/vrame/images/rte/close.gif b/public/vrame/images/rte/close.gif deleted file mode 100644 index a7acb7f..0000000 Binary files a/public/vrame/images/rte/close.gif and /dev/null differ diff --git a/public/vrame/images/rte/image.png b/public/vrame/images/rte/image.png deleted file mode 100644 index ccc7a10..0000000 Binary files a/public/vrame/images/rte/image.png and /dev/null differ diff --git a/public/vrame/images/rte/italic.gif b/public/vrame/images/rte/italic.gif deleted file mode 100644 index 58a2871..0000000 Binary files a/public/vrame/images/rte/italic.gif and /dev/null differ diff --git a/public/vrame/images/rte/link.png b/public/vrame/images/rte/link.png deleted file mode 100644 index aff8475..0000000 Binary files a/public/vrame/images/rte/link.png and /dev/null differ diff --git a/public/vrame/images/rte/striptags.gif b/public/vrame/images/rte/striptags.gif deleted file mode 100644 index 885e58a..0000000 Binary files a/public/vrame/images/rte/striptags.gif and /dev/null differ diff --git a/public/vrame/images/rte/unordered.gif b/public/vrame/images/rte/unordered.gif deleted file mode 100644 index de8448e..0000000 Binary files a/public/vrame/images/rte/unordered.gif and /dev/null differ diff --git a/public/vrame/images/tipsy/east.gif b/public/vrame/images/tipsy/east.gif deleted file mode 100644 index 697550b..0000000 Binary files a/public/vrame/images/tipsy/east.gif and /dev/null differ diff --git a/public/vrame/images/tipsy/north.gif b/public/vrame/images/tipsy/north.gif deleted file mode 100644 index c22e72b..0000000 Binary files a/public/vrame/images/tipsy/north.gif and /dev/null differ diff --git a/public/vrame/images/tipsy/south.gif b/public/vrame/images/tipsy/south.gif deleted file mode 100644 index cd48fcd..0000000 Binary files a/public/vrame/images/tipsy/south.gif and /dev/null differ diff --git a/public/vrame/images/tipsy/west.gif b/public/vrame/images/tipsy/west.gif deleted file mode 100644 index bd51b57..0000000 Binary files a/public/vrame/images/tipsy/west.gif and /dev/null differ diff --git a/public/vrame/javascripts/application.js b/public/vrame/javascripts/application.js deleted file mode 100644 index 4abdae6..0000000 --- a/public/vrame/javascripts/application.js +++ /dev/null @@ -1,91 +0,0 @@ -(function () { - - var ap = Array.prototype, - fp = Function.prototype; - - function convert (obj, sliceStart) { - return ap.slice.apply(obj, sliceStart); - }; - - if (!fp.curry) { - fp.curry = f_Function_prototype_curry; - } - - if (!fp.bind) { - fp.bind = f_Function_prototype_bind; - } - - function f_Function_prototype_curry () { - if (arguments.length == 0) { - return this; - } - var method = this, - bindArgs = convert(arguments); - return function f_curried_function () { - var mergedArgs = bindArgs.concat( convert(arguments) ); - return method.apply(this, mergedArgs); - }; - } - - function f_Function_prototype_bind (context) { - var length = arguments.length, - method = this, - bindArgs; - if (length == 0) { - return this; - } - bindArgs = length > 1 ? convert(arguments, 1) : []; - return function f_bound_function () { - var mergedArgs = bindArgs.concat( convert(arguments) ); - return method.apply(context, mergedArgs); - }; - } - -})(); - -jQuery(function($) { - - /* Main Navigation */ - $('#nav').droppy({ speed: 0 }); - - /* News flashes */ - $('.flash').click(function() { - $(this).fadeOut(); - }); - - /* Expandable sections */ - $('.expandable').click(function() { - $($(this).attr('href')).slideToggle(); - return false; - }); - - /* Tooltips */ - $('.tooltip').tipsy({ gravity: 'w' }); - - /* Rich Text Editing Textareas */ - $('.rte-zone').rte({ - media_url : '/vrame/images/rte/', - content_css_url: '/vrame/stylesheets/rte.css' - }); - - /* Date picker */ - if ($('.datepicker').size() > 0) { - $('.datepicker').datepicker({ - duration: '', - showTime: true, - constrainInput: false - }); - } - - /* Input field placeholder text */ - $('input[type=text][placeholder], textarea[placeholder]').placeholder(); - - /* give window.name a unique id */ - function generateUUID () { - return +new Date; - } - - if(!window.name) { - window.name = generateUUID(); - } -}); diff --git a/public/vrame/javascripts/asset-list.js b/public/vrame/javascripts/asset-list.js deleted file mode 100644 index a6c864e..0000000 --- a/public/vrame/javascripts/asset-list.js +++ /dev/null @@ -1,153 +0,0 @@ -/* Asset list behavior */ - -jQuery(function ($) { - - var assetListSelector = '.asset-list', - textareaSelector = 'textarea[name=title]'; - - /* Event Handling */ - - var assetLists = $(assetListSelector) - - /* Asset deletion */ - .find('a.delete') - .live('click', deleteAsset) - .end() - - /* Image fullview */ - .find('.image-wrapper') - .attr('title', 'Klicken zum Vergrößern') - .live('click', loadFullview) - .end() - - /* Title editing and saving */ - .find(textareaSelector) - .live('keypress', saveTitle) - .end() - /* Event delegation with bubbling focusout */ - .bind('focusout', saveTitle) - /* Event delegation with capturing blur */ - .each(captureTextareaBlur); - - /* Asset deletion */ - - function deleteAsset (e) { - e.preventDefault(); - - if (!confirm('Wirklich löschen?')) { - return false; - } - - var deleteLink = $(this); - - /* Hide corresponding asset list item */ - deleteLink.closest('li').hide(); - - /* Remove asset id from hidden input field */ - var uploadContainer = deleteLink.closest('div.file-upload'); - var uploadType = uploadContainer.attr('data-upload-type'); - if (uploadType == 'asset') { - vrame.unsavedChanges = true; - uploadContainer.find('input.asset-id').val(''); - } - - /* Send DELETE request */ - $.post(deleteLink.attr('href'), { - _method: 'delete', - authenticity_token: deleteLink.attr('data-authenticity-token') - }); - } - - /* Image fullview */ - - var image = $('') - .attr('id', 'asset-fullview') - .attr('title', 'Vollansicht schließen') - .click(hideFullview) - .load(showFullview) - .css('display', 'none') - .appendTo(document.body), - wrapperWidth, - wrapperHeight, - wrapperOffset; - - function hideFullview () { - image.css('display', 'none'); - } - - function loadFullview () { - var wrapper = jQuery(this), - fullUrl = wrapper.attr('fullurl'); - if (!fullUrl) { - return; - } - wrapperWidth = wrapper.width(); - wrapperHeight = wrapper.height(); - wrapperOffset = wrapper.offset(); - image.attr('src', fullUrl); - } - - function showFullview () { - image.css({ - left : Math.max(0, wrapperOffset.left - (image.attr('width') - wrapperWidth) / 2), - top : Math.max(0, wrapperOffset.top - (image.attr('height') - wrapperHeight) / 2), - //left : wrapperOffset.left, - //top : wrapperOffset.top, - display : 'block' - }); - } - - /* Title editing and saving */ - - function captureTextareaBlur () { - if (this.addEventListener) { - this.addEventListener('blur', saveTitle, true); - } - } - - function saveTitle (e) { - //console.log('saveTitle', e.type); - var textarea = $(e.target), - saveInterval, - closure = function () { - sendTitle(textarea); - }; - if (!textarea.is(textareaSelector)) { - return; - } - clearInterval(textarea.data('saveInterval')); - if (e.type == 'keypress') { - saveInterval = setTimeout(closure, 2000); - textarea.data('saveInterval', saveInterval); - } else { - closure(); - } - } - - function sendTitle (textarea) { - //console.log('sendTitle'); - var assetId = textarea.attr('data-asset-id'); - $('#ajax-loading-bar').fadeIn('fast'); - $.post( - '/vrame/assets/' + assetId, - { - 'asset[title]' : textarea.val(), - '_method' : 'put', - 'authenticity_token' : textarea.attr('data-authenticity-token') - }, - function (responseData) { - titleSent(responseData, textarea); - } - ); - } - - function titleSent (responseData, textarea) { - //console.log('titleSent', responseData); - $('#ajax-loading-bar').stop().fadeOut('fast'); - var originalBackgroundColor = textarea.css('backgroundColor'); - textarea - .css('backgroundColor', '#ffb') - .animate({'backgroundColor' : originalBackgroundColor}, 800); - } - -}); \ No newline at end of file diff --git a/public/vrame/javascripts/category-view.js b/public/vrame/javascripts/category-view.js deleted file mode 100644 index a4b00a6..0000000 --- a/public/vrame/javascripts/category-view.js +++ /dev/null @@ -1,50 +0,0 @@ -/* Category view */ - -jQuery(function($) { - - var activeCategory = null, - activeCategoryClass = 'active-category'; - - $('.content-view .category-button').click(categoryClick); - - function categoryClick (e) { - e.preventDefault(); - - var link = $(this), - activeCategoryName = link.find('span.plain-title').text(), - activeCategory = link.closest('.category'), - activeCategoryId = activeCategory.attr('data-category-id'); - - /* Set active category */ - $('.content-view .' + activeCategoryClass).removeClass(activeCategoryClass); - activeCategory.addClass(activeCategoryClass); - - /* Load documents */ - $(document).scrollTo({ top: 0, left: 0 }, 200); - $('#ajax-loading-bar').fadeIn('fast'); - $.ajax({ - url: '/vrame/categories/' + activeCategoryId + '/documents/?tab_id=' + window.name, - cache: false, - success: documentsLoaded, - error: function(msg) { - console.log(msg); - } - }); - - updateControls(activeCategoryName, activeCategoryId); - } - - function documentsLoaded (html) { - $('.content-view #items').html(html); - $('#ajax-loading-bar').stop().fadeOut('fast'); - } - - function updateControls (activeCategoryName, activeCategoryId) { - $('#active-category-name').text('/ ' + activeCategoryName); - /* Update button targets */ - $('#active-category-edit') .attr('href', '/vrame/categories/' + activeCategoryId + '/edit'); - $('#active-category-new-document').attr('href', '/vrame/categories/' + activeCategoryId + '/documents/new'); - $('#active-category-new-category').attr('href', '/vrame/categories/' + activeCategoryId + '/categories/new'); - } - -}); \ No newline at end of file diff --git a/public/vrame/javascripts/jquery/jquery-1.3.2.js b/public/vrame/javascripts/jquery/jquery-1.3.2.js deleted file mode 100644 index 462cde5..0000000 --- a/public/vrame/javascripts/jquery/jquery-1.3.2.js +++ /dev/null @@ -1,4376 +0,0 @@ -/*! - * jQuery JavaScript Library v1.3.2 - * http://jquery.com/ - * - * Copyright (c) 2009 John Resig - * Dual licensed under the MIT and GPL licenses. - * http://docs.jquery.com/License - * - * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) - * Revision: 6246 - */ -(function(){ - -var - // Will speed up references to window, and allows munging its name. - window = this, - // Will speed up references to undefined, and allows munging its name. - undefined, - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - // Map over the $ in case of overwrite - _$ = window.$, - - jQuery = window.jQuery = window.$ = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context ); - }, - - // A simple way to check for HTML strings or ID strings - // (both of which we optimize for) - quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, - // Is it a simple selector - isSimple = /^.[^:#\[\.,]*$/; - -jQuery.fn = jQuery.prototype = { - init: function( selector, context ) { - // Make sure that a selection was provided - selector = selector || document; - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this[0] = selector; - this.length = 1; - this.context = selector; - return this; - } - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - var match = quickExpr.exec( selector ); - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) - selector = jQuery.clean( [ match[1] ], context ); - - // HANDLE: $("#id") - else { - var elem = document.getElementById( match[3] ); - - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem && elem.id != match[3] ) - return jQuery().find( selector ); - - // Otherwise, we inject the element directly into the jQuery object - var ret = jQuery( elem || [] ); - ret.context = document; - ret.selector = selector; - return ret; - } - - // HANDLE: $(expr, [context]) - // (which is just equivalent to: $(content).find(expr) - } else - return jQuery( context ).find( selector ); - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) - return jQuery( document ).ready( selector ); - - // Make sure that old selector state is passed along - if ( selector.selector && selector.context ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return this.setArray(jQuery.isArray( selector ) ? - selector : - jQuery.makeArray(selector)); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.3.2", - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num === undefined ? - - // Return a 'clean' array - Array.prototype.slice.call( this ) : - - // Return just the object - this[ num ]; - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = jQuery( elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) - ret.selector = this.selector + (this.selector ? " " : "") + selector; - else if ( name ) - ret.selector = this.selector + "." + name + "(" + selector + ")"; - - // Return the newly-formed element set - return ret; - }, - - // Force the current matched set of elements to become - // the specified array of elements (destroying the stack in the process) - // You should use pushStack() in order to do this, but maintain the stack - setArray: function( elems ) { - // Resetting the length to 0, then using the native Array push - // is a super-fast way to populate an object with array-like properties - this.length = 0; - Array.prototype.push.apply( this, elems ); - - return this; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem && elem.jquery ? elem[0] : elem - , this ); - }, - - attr: function( name, value, type ) { - var options = name; - - // Look for the case where we're accessing a style value - if ( typeof name === "string" ) - if ( value === undefined ) - return this[0] && jQuery[ type || "attr" ]( this[0], name ); - - else { - options = {}; - options[ name ] = value; - } - - // Check to see if we're setting style values - return this.each(function(i){ - // Set all the styles - for ( name in options ) - jQuery.attr( - type ? - this.style : - this, - name, jQuery.prop( this, options[ name ], type, i, name ) - ); - }); - }, - - css: function( key, value ) { - // ignore negative width and height values - if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) - value = undefined; - return this.attr( key, value, "curCSS" ); - }, - - text: function( text ) { - if ( typeof text !== "object" && text != null ) - return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); - - var ret = ""; - - jQuery.each( text || this, function(){ - jQuery.each( this.childNodes, function(){ - if ( this.nodeType != 8 ) - ret += this.nodeType != 1 ? - this.nodeValue : - jQuery.fn.text( [ this ] ); - }); - }); - - return ret; - }, - - wrapAll: function( html ) { - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).clone(); - - if ( this[0].parentNode ) - wrap.insertBefore( this[0] ); - - wrap.map(function(){ - var elem = this; - - while ( elem.firstChild ) - elem = elem.firstChild; - - return elem; - }).append(this); - } - - return this; - }, - - wrapInner: function( html ) { - return this.each(function(){ - jQuery( this ).contents().wrapAll( html ); - }); - }, - - wrap: function( html ) { - return this.each(function(){ - jQuery( this ).wrapAll( html ); - }); - }, - - append: function() { - return this.domManip(arguments, true, function(elem){ - if (this.nodeType == 1) - this.appendChild( elem ); - }); - }, - - prepend: function() { - return this.domManip(arguments, true, function(elem){ - if (this.nodeType == 1) - this.insertBefore( elem, this.firstChild ); - }); - }, - - before: function() { - return this.domManip(arguments, false, function(elem){ - this.parentNode.insertBefore( elem, this ); - }); - }, - - after: function() { - return this.domManip(arguments, false, function(elem){ - this.parentNode.insertBefore( elem, this.nextSibling ); - }); - }, - - end: function() { - return this.prevObject || jQuery( [] ); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: [].push, - sort: [].sort, - splice: [].splice, - - find: function( selector ) { - if ( this.length === 1 ) { - var ret = this.pushStack( [], "find", selector ); - ret.length = 0; - jQuery.find( selector, this[0], ret ); - return ret; - } else { - return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){ - return jQuery.find( selector, elem ); - })), "find", selector ); - } - }, - - clone: function( events ) { - // Do the clone - var ret = this.map(function(){ - if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { - // IE copies events bound via attachEvent when - // using cloneNode. Calling detachEvent on the - // clone will also remove the events from the orignal - // In order to get around this, we use innerHTML. - // Unfortunately, this means some modifications to - // attributes in IE that are actually only stored - // as properties will not be copied (such as the - // the name attribute on an input). - var html = this.outerHTML; - if ( !html ) { - var div = this.ownerDocument.createElement("div"); - div.appendChild( this.cloneNode(true) ); - html = div.innerHTML; - } - - return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; - } else - return this.cloneNode(true); - }); - - // Copy the events from the original to the clone - if ( events === true ) { - var orig = this.find("*").andSelf(), i = 0; - - ret.find("*").andSelf().each(function(){ - if ( this.nodeName !== orig[i].nodeName ) - return; - - var events = jQuery.data( orig[i], "events" ); - - for ( var type in events ) { - for ( var handler in events[ type ] ) { - jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); - } - } - - i++; - }); - } - - // Return the cloned set - return ret; - }, - - filter: function( selector ) { - return this.pushStack( - jQuery.isFunction( selector ) && - jQuery.grep(this, function(elem, i){ - return selector.call( elem, i ); - }) || - - jQuery.multiFilter( selector, jQuery.grep(this, function(elem){ - return elem.nodeType === 1; - }) ), "filter", selector ); - }, - - closest: function( selector ) { - var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, - closer = 0; - - return this.map(function(){ - var cur = this; - while ( cur && cur.ownerDocument ) { - if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { - jQuery.data(cur, "closest", closer); - return cur; - } - cur = cur.parentNode; - closer++; - } - }); - }, - - not: function( selector ) { - if ( typeof selector === "string" ) - // test special case where just one selector is passed in - if ( isSimple.test( selector ) ) - return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector ); - else - selector = jQuery.multiFilter( selector, this ); - - var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; - return this.filter(function() { - return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; - }); - }, - - add: function( selector ) { - return this.pushStack( jQuery.unique( jQuery.merge( - this.get(), - typeof selector === "string" ? - jQuery( selector ) : - jQuery.makeArray( selector ) - ))); - }, - - is: function( selector ) { - return !!selector && jQuery.multiFilter( selector, this ).length > 0; - }, - - hasClass: function( selector ) { - return !!selector && this.is( "." + selector ); - }, - - val: function( value ) { - if ( value === undefined ) { - var elem = this[0]; - - if ( elem ) { - if( jQuery.nodeName( elem, 'option' ) ) - return (elem.attributes.value || {}).specified ? elem.value : elem.text; - - // We need to handle select boxes special - if ( jQuery.nodeName( elem, "select" ) ) { - var index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type == "select-one"; - - // Nothing was selected - if ( index < 0 ) - return null; - - // Loop through all the selected options - for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { - var option = options[ i ]; - - if ( option.selected ) { - // Get the specifc value for the option - value = jQuery(option).val(); - - // We don't need an array for one selects - if ( one ) - return value; - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - } - - // Everything else, we just grab the value - return (elem.value || "").replace(/\r/g, ""); - - } - - return undefined; - } - - if ( typeof value === "number" ) - value += ''; - - return this.each(function(){ - if ( this.nodeType != 1 ) - return; - - if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) ) - this.checked = (jQuery.inArray(this.value, value) >= 0 || - jQuery.inArray(this.name, value) >= 0); - - else if ( jQuery.nodeName( this, "select" ) ) { - var values = jQuery.makeArray(value); - - jQuery( "option", this ).each(function(){ - this.selected = (jQuery.inArray( this.value, values ) >= 0 || - jQuery.inArray( this.text, values ) >= 0); - }); - - if ( !values.length ) - this.selectedIndex = -1; - - } else - this.value = value; - }); - }, - - html: function( value ) { - return value === undefined ? - (this[0] ? - this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : - null) : - this.empty().append( value ); - }, - - replaceWith: function( value ) { - return this.after( value ).remove(); - }, - - eq: function( i ) { - return this.slice( i, +i + 1 ); - }, - - slice: function() { - return this.pushStack( Array.prototype.slice.apply( this, arguments ), - "slice", Array.prototype.slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function(elem, i){ - return callback.call( elem, i, elem ); - })); - }, - - andSelf: function() { - return this.add( this.prevObject ); - }, - - domManip: function( args, table, callback ) { - if ( this[0] ) { - var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(), - scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ), - first = fragment.firstChild; - - if ( first ) - for ( var i = 0, l = this.length; i < l; i++ ) - callback.call( root(this[i], first), this.length > 1 || i > 0 ? - fragment.cloneNode(true) : fragment ); - - if ( scripts ) - jQuery.each( scripts, evalScript ); - } - - return this; - - function root( elem, cur ) { - return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ? - (elem.getElementsByTagName("tbody")[0] || - elem.appendChild(elem.ownerDocument.createElement("tbody"))) : - elem; - } - } -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -function evalScript( i, elem ) { - if ( elem.src ) - jQuery.ajax({ - url: elem.src, - async: false, - dataType: "script" - }); - - else - jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); - - if ( elem.parentNode ) - elem.parentNode.removeChild( elem ); -} - -function now(){ - return +new Date; -} - -jQuery.extend = jQuery.fn.extend = function() { - // copy reference to target object - var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) - target = {}; - - // extend jQuery itself if only one argument is passed - if ( length == i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) - // Extend the base object - for ( var name in options ) { - var src = target[ name ], copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) - continue; - - // Recurse if we're merging object values - if ( deep && copy && typeof copy === "object" && !copy.nodeType ) - target[ name ] = jQuery.extend( deep, - // Never move original objects, clone them - src || ( copy.length != null ? [ ] : { } ) - , copy ); - - // Don't bring in undefined values - else if ( copy !== undefined ) - target[ name ] = copy; - - } - - // Return the modified object - return target; -}; - -// exclude the following css properties to add px -var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, - // cache defaultView - defaultView = document.defaultView || {}, - toString = Object.prototype.toString; - -jQuery.extend({ - noConflict: function( deep ) { - window.$ = _$; - - if ( deep ) - window.jQuery = _jQuery; - - return jQuery; - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return toString.call(obj) === "[object Function]"; - }, - - isArray: function( obj ) { - return toString.call(obj) === "[object Array]"; - }, - - // check if an element is in a (or is an) XML document - isXMLDoc: function( elem ) { - return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || - !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument ); - }, - - // Evalulates a script in a global context - globalEval: function( data ) { - if ( data && /\S/.test(data) ) { - // Inspired by code by Andrea Giammarchi - // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html - var head = document.getElementsByTagName("head")[0] || document.documentElement, - script = document.createElement("script"); - - script.type = "text/javascript"; - if ( jQuery.support.scriptEval ) - script.appendChild( document.createTextNode( data ) ); - else - script.text = data; - - // Use insertBefore instead of appendChild to circumvent an IE6 bug. - // This arises when a base node is used (#2709). - head.insertBefore( script, head.firstChild ); - head.removeChild( script ); - } - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, length = object.length; - - if ( args ) { - if ( length === undefined ) { - for ( name in object ) - if ( callback.apply( object[ name ], args ) === false ) - break; - } else - for ( ; i < length; ) - if ( callback.apply( object[ i++ ], args ) === false ) - break; - - // A special, fast, case for the most common use of each - } else { - if ( length === undefined ) { - for ( name in object ) - if ( callback.call( object[ name ], name, object[ name ] ) === false ) - break; - } else - for ( var value = object[0]; - i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} - } - - return object; - }, - - prop: function( elem, value, type, i, name ) { - // Handle executable functions - if ( jQuery.isFunction( value ) ) - value = value.call( elem, i ); - - // Handle passing in a number to a CSS property - return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ? - value + "px" : - value; - }, - - className: { - // internal only, use addClass("class") - add: function( elem, classNames ) { - jQuery.each((classNames || "").split(/\s+/), function(i, className){ - if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) - elem.className += (elem.className ? " " : "") + className; - }); - }, - - // internal only, use removeClass("class") - remove: function( elem, classNames ) { - if (elem.nodeType == 1) - elem.className = classNames !== undefined ? - jQuery.grep(elem.className.split(/\s+/), function(className){ - return !jQuery.className.has( classNames, className ); - }).join(" ") : - ""; - }, - - // internal only, use hasClass("class") - has: function( elem, className ) { - return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; - } - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations - swap: function( elem, options, callback ) { - var old = {}; - // Remember the old values, and insert the new ones - for ( var name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - callback.call( elem ); - - // Revert the old values - for ( var name in options ) - elem.style[ name ] = old[ name ]; - }, - - css: function( elem, name, force, extra ) { - if ( name == "width" || name == "height" ) { - var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; - - function getWH() { - val = name == "width" ? elem.offsetWidth : elem.offsetHeight; - - if ( extra === "border" ) - return; - - jQuery.each( which, function() { - if ( !extra ) - val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; - if ( extra === "margin" ) - val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; - else - val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; - }); - } - - if ( elem.offsetWidth !== 0 ) - getWH(); - else - jQuery.swap( elem, props, getWH ); - - return Math.max(0, Math.round(val)); - } - - return jQuery.curCSS( elem, name, force ); - }, - - curCSS: function( elem, name, force ) { - var ret, style = elem.style; - - // We need to handle opacity special in IE - if ( name == "opacity" && !jQuery.support.opacity ) { - ret = jQuery.attr( style, "opacity" ); - - return ret == "" ? - "1" : - ret; - } - - // Make sure we're using the right name for getting the float value - if ( name.match( /float/i ) ) - name = styleFloat; - - if ( !force && style && style[ name ] ) - ret = style[ name ]; - - else if ( defaultView.getComputedStyle ) { - - // Only "float" is needed here - if ( name.match( /float/i ) ) - name = "float"; - - name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); - - var computedStyle = defaultView.getComputedStyle( elem, null ); - - if ( computedStyle ) - ret = computedStyle.getPropertyValue( name ); - - // We should always get a number back from opacity - if ( name == "opacity" && ret == "" ) - ret = "1"; - - } else if ( elem.currentStyle ) { - var camelCase = name.replace(/\-(\w)/g, function(all, letter){ - return letter.toUpperCase(); - }); - - ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { - // Remember the original values - var left = style.left, rsLeft = elem.runtimeStyle.left; - - // Put in the new values to get a computed value out - elem.runtimeStyle.left = elem.currentStyle.left; - style.left = ret || 0; - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - elem.runtimeStyle.left = rsLeft; - } - } - - return ret; - }, - - clean: function( elems, context, fragment ) { - context = context || document; - - // !context.createElement fails in IE with an error but returns typeof 'object' - if ( typeof context.createElement === "undefined" ) - context = context.ownerDocument || context[0] && context[0].ownerDocument || document; - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { - var match = /^<(\w+)\s*\/?>$/.exec(elems[0]); - if ( match ) - return [ context.createElement( match[1] ) ]; - } - - var ret = [], scripts = [], div = context.createElement("div"); - - jQuery.each(elems, function(i, elem){ - if ( typeof elem === "number" ) - elem += ''; - - if ( !elem ) - return; - - // Convert html string into DOM nodes - if ( typeof elem === "string" ) { - // Fix "XHTML"-style tags in all browsers - elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ - return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? - all : - front + ">"; - }); - - // Trim whitespace, otherwise indexOf won't work as expected - var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase(); - - var wrap = - // option or optgroup - !tags.indexOf("", "" ] || - - !tags.indexOf("", "" ] || - - tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && - [ 1, "", "
      " ] || - - !tags.indexOf("", "" ] || - - // matched above - (!tags.indexOf("", "" ] || - - !tags.indexOf("", "" ] || - - // IE can't serialize and - - Notes: - You must provide set minimum_flash_version setting to "8" if you are using SWFUpload for Flash Player 8. - The swfuploadLoadFailed event is only fired if the minimum version of Flash Player is not met. Other issues such as missing SWF files, browser bugs - or corrupt Flash Player installations will not trigger this event. - The swfuploadPreLoad event is fired as soon as the minimum version of Flash Player is found. It does not wait for SWFUpload to load and can - be used to prepare the SWFUploadUI and hide alternate content. - swfobject's onDomReady event is cross-browser safe but will default to the window.onload event when DOMReady is not supported by the browser. - Early DOM Loading is supported in major modern browsers but cannot be guaranteed for every browser ever made. -*/ - - -/* SWFObject v2.1 - Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis - This software is released under the MIT License -*/ -var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("