From: yasushiito Date: Fri, 18 Apr 2014 07:10:07 +0000 (+0900) Subject: Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=ca071ae6b2bc69089d48271a717dc775a77fc380;hp=0b7174946e26683127e4b4eebda9a2cf87e64b78;p=pettanr%2Fpettanr.git Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06 --- diff --git a/Gemfile b/Gemfile index 289e6132..d9887dd6 100644 --- a/Gemfile +++ b/Gemfile @@ -8,6 +8,7 @@ gem 'backbone-rails' gem 'kaminari' gem 'sanitize' gem 'aws-s3' +gem 'awesome_nested_set' gem 'validates_existence' gem "validate_url" gem "pettanr_creative_commons_v30_licenses" diff --git a/app/assets/javascripts/folders.js.coffee b/app/assets/javascripts/folders.js.coffee new file mode 100644 index 00000000..76156794 --- /dev/null +++ b/app/assets/javascripts/folders.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/manifest/work/forms.js.coffee.erb b/app/assets/javascripts/manifest/work/forms.js.coffee.erb index 642cc368..9df9ebc7 100644 --- a/app/assets/javascripts/manifest/work/forms.js.coffee.erb +++ b/app/assets/javascripts/manifest/work/forms.js.coffee.erb @@ -1396,7 +1396,7 @@ 'open', 'commercial', 'official', - 'attribution:', + 'attribution', 'derive', 'thumbnail', 'gif_convert', diff --git a/app/assets/stylesheets/folders.css.scss b/app/assets/stylesheets/folders.css.scss new file mode 100644 index 00000000..1dea7914 --- /dev/null +++ b/app/assets/stylesheets/folders.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the folders controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/folders_controller.rb b/app/controllers/folders_controller.rb new file mode 100644 index 00000000..318f1c84 --- /dev/null +++ b/app/controllers/folders_controller.rb @@ -0,0 +1,32 @@ +class FoldersController < ApplicationController + if Manifest.manifest.magic_numbers['run_mode'] == 0 + before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy] + else + before_filter :authenticate_reader, :only => [:index, :show] + before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy] + end + + def self.model + Folder + end + + def index + filer_list + end + + def show_html_format format + format.html { + @folder = @item + } + end + + def show + set_show + respond_to do |format| + show_html_format format + show_prof_format format + show_json_format format + end + end + +end diff --git a/app/helpers/folders_helper.rb b/app/helpers/folders_helper.rb new file mode 100644 index 00000000..d27e7b4f --- /dev/null +++ b/app/helpers/folders_helper.rb @@ -0,0 +1,2 @@ +module FoldersHelper +end diff --git a/app/models/folder.rb b/app/models/folder.rb new file mode 100644 index 00000000..c3c8673c --- /dev/null +++ b/app/models/folder.rb @@ -0,0 +1,17 @@ +class Folder < Peta::Item + acts_as_nested_set + + validates :controller_name, :length => {:maximum => 200} + validates :action_name, :length => {:maximum => 200} + validates :category_id, :presence => true, :numericality => true + validates :t, :presence => true, :numericality => true + + def self.generate + if self.root + else + self.create :category_id => 0 + end + + end + +end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 54accf3e..e50c6e80 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,64 +1,69 @@

<%= t '.title' -%>

+<% if @operators.author -%>

<%= link_to h(@operators.author.name), main_app.author_path(@operators.author) -%>

<%= t('.updated_scroll') -%>

- - - - - - - - - - - - - -
- <%= link_to t_m('Scroll'), '/home/scrolls' %> - <%= link_to t('*'), new_scroll_path %> - - <%= link_to t_m('ScrollPanel'), '/home/scroll_panels' %> - <%= link_to t('*'), new_scroll_panel_path %> - - <%= link_to t_m('Comic'), '/home/comics' %> - <%= link_to t('*'), new_comic_path %> - - <%= link_to t_m('Story'), '/home/stories' %> - <%= link_to t('*'), new_story_path %> -
- <%= link_to t_m('StorySheet'), '/home/story_sheets' %> - <%= link_to t('*'), new_story_sheet_path %> - - <%= link_to t_m('Sheet'), '/home/sheets' %> - <%= link_to t('*'), new_sheet_path %> - - <%= link_to t_m('SheetPanel'), '/home/sheet_panels' %> - <%= link_to t('*'), new_sheet_panel_path %> - - <%= link_to t_m('Panel'), '/home/panels' %> - <%= link_to t('*'), new_panel_path %> -
-

<%= t('.used_element') -%>

- - - - - - - - -
- <%= link_to t_m('PanelPicture'), '/home/panel_pictures' %> - - <%= link_to t_m('SpeechBalloon'), '/home/speech_balloons' %> - - <%= link_to t_m('GroundPicture'), '/home/ground_pictures' %> - - <%= link_to t_m('GroundColor'), '/home/ground_colors' %> - <%= link_to t('*'), new_ground_color_path %> - -
+ + + + + + + + + + + + + +
+ <%= link_to t_m('Scroll'), '/home/scrolls' %> + <%= link_to t('*'), new_scroll_path %> + + <%= link_to t_m('ScrollPanel'), '/home/scroll_panels' %> + <%= link_to t('*'), new_scroll_panel_path %> + + <%= link_to t_m('Comic'), '/home/comics' %> + <%= link_to t('*'), new_comic_path %> + + <%= link_to t_m('Story'), '/home/stories' %> + <%= link_to t('*'), new_story_path %> +
+ <%= link_to t_m('StorySheet'), '/home/story_sheets' %> + <%= link_to t('*'), new_story_sheet_path %> + + <%= link_to t_m('Sheet'), '/home/sheets' %> + <%= link_to t('*'), new_sheet_path %> + + <%= link_to t_m('SheetPanel'), '/home/sheet_panels' %> + <%= link_to t('*'), new_sheet_panel_path %> + + <%= link_to t_m('Panel'), '/home/panels' %> + <%= link_to t('*'), new_panel_path %> +
+

<%= t('.used_element') -%>

+ + + + + + + + +
+ <%= link_to t_m('PanelPicture'), '/home/panel_pictures' %> + + <%= link_to t_m('SpeechBalloon'), '/home/speech_balloons' %> + + <%= link_to t_m('GroundPicture'), '/home/ground_pictures' %> + + <%= link_to t_m('GroundColor'), '/home/ground_colors' %> + <%= link_to t('*'), new_ground_color_path %> + +
+<% else -%> +

<%= t('.author') -%>

+

<%= link_to t('.not_author'), main_app.new_author_path -%>

+<% end -%> <% if @operators.artist -%>

<%= link_to h(@operators.artist.name), main_app.artist_path(@operators.artist) -%>

<%= t('.updated_picture') -%>

@@ -81,6 +86,5 @@ <% else -%>

<%= t('.artist') -%>

-

<%= t('.updated_picture') -%>

<%= link_to t('.not_artist'), main_app.new_artist_path -%>

<% end -%> diff --git a/app/views/templates/r/form/_extend_fform.html.erb b/app/views/templates/r/form/_extend_form.html.erb similarity index 54% rename from app/views/templates/r/form/_extend_fform.html.erb rename to app/views/templates/r/form/_extend_form.html.erb index d3e78934..b9868b6f 100644 --- a/app/views/templates/r/form/_extend_fform.html.erb +++ b/app/views/templates/r/form/_extend_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for(form.item, :html => form.item.tag_attributes('form', 'data-form-name' => form.form_name)) do |f| %> +<%= form_for(form.item) do |f| %> <%= render 'system/error_explanation', :obj => form.item %> <%= render form.fields_template_name, :form => form, :f => f %> <% end %> diff --git a/app/views/templates/r/form/_fields.html.erb b/app/views/templates/r/form/_fields.html.erb index 15b510e6..7202fd26 100644 --- a/app/views/templates/r/form/_fields.html.erb +++ b/app/views/templates/r/form/_fields.html.erb @@ -1,5 +1,5 @@
<% form.each_field do |field_name, field| %> - <%= render field.template_name, :field => field %> + <%= render field.template_name, field.template_option %> <% end %>
diff --git a/config/locales/pettanr.ja.yml b/config/locales/pettanr.ja.yml index 309d9e15..05818545 100644 --- a/config/locales/pettanr.ja.yml +++ b/config/locales/pettanr.ja.yml @@ -483,7 +483,9 @@ ja: catch: つかんでいるコマ used_element: 最近使った部品 updated_picture: 最近更新した画像 + author: 作家 artist: 絵師 + not_author: 作品を公開するには作家登録 not_artist: 画像を公開するには絵師登録 scrolls: title: 最近更新したスクロール @@ -1084,6 +1086,9 @@ ja: title: 作家プロフィール編集 destroy: title: 休筆 + submit: + new: 登録 + edit: 変更 artists: index: title: 絵師一覧 @@ -1102,6 +1107,9 @@ ja: title: 絵師プロフィール編集 destroy: title: 活動停止 + submit: + new: 登録 + edit: 変更 system_pictures: index: title: システム画像一覧 diff --git a/db/migrate/20140415021754_create_folders.rb b/db/migrate/20140415021754_create_folders.rb new file mode 100644 index 00000000..265e3790 --- /dev/null +++ b/db/migrate/20140415021754_create_folders.rb @@ -0,0 +1,17 @@ +class CreateFolders < ActiveRecord::Migration + def change + create_table :folders do |t| + t.string :controller_name, :null => false + t.string :action_name, :null => false + t.integer :category_id, :null => false, :default => 0 + t.integer :t, :null => false, :default => 0 + t.integer :parent_id + t.integer :lft + t.integer :rgt + t.integer :depth # this is optional. + + t.timestamps + end + add_index :folders , [:rgt] + end +end diff --git a/lib/locmare/form.rb b/lib/locmare/form.rb index a9e30545..ce926605 100644 --- a/lib/locmare/form.rb +++ b/lib/locmare/form.rb @@ -54,8 +54,8 @@ module Locmare def init_fields @manifest.each_field do |field_name, field_manifest| if boost_name = @item.class.find_boost_name(field_name) + p [field_name] extend_form_name = @item.boosters[boost_name].model_name - extend_form_manifest = LocalManifest.manifest.forms[extend_form_name] extend_item = @item.boosters[boost_name].extend_item @fields[field_name] = ExtendForm.new self, extend_form_name, extend_item, @mounted, @operators else @@ -97,13 +97,7 @@ module Locmare def init_fields @manifest.each_field do |field_name, field_manifest| - if boost_name = @item.class.find_boost_name(field_name) - extend_form_name = @item.boosters[boost_name].model_name - extend_form_manifest = LocalManifest.manifest.forms[extend_form_name] - @fields[field_name] = ExtendField.new self, field_name, field_manifest, @item.boosters[n].extend_item - else - # @fields[field_name] = Field.new self, field_name, field_manifest - end + @fields[field_name] = ExtendField.new self, field_name, field_manifest end end @@ -111,6 +105,10 @@ module Locmare "extend_form" end + def template_option + {:form=> self} + end + end end diff --git a/lib/locmare/form/extend_field.rb b/lib/locmare/form/extend_field.rb index 1987c4aa..01abed51 100644 --- a/lib/locmare/form/extend_field.rb +++ b/lib/locmare/form/extend_field.rb @@ -1,6 +1,7 @@ module Locmare module FormModule class ExtendField + include FieldModule attr :form, :field_name, :field_manifest, :label, :tag, :helpers, :options def initialize form, field_name, field_manifest @@ -33,7 +34,7 @@ module Locmare end def options tag_options = {} - self.item.field_tag_attributes(@field_manifest.column_name, tag_options).merge(self.mount_option) + tag_options end def form_field_name @@ -56,6 +57,10 @@ module Locmare self.template_dir + self.template_file_name end + def template_option + {:field => self} + end + def row_break_template_dir @form.template_dir + 'row_break/' end diff --git a/lib/locmare/form/field.rb b/lib/locmare/form/field.rb index fc24e939..5fa970b4 100644 --- a/lib/locmare/form/field.rb +++ b/lib/locmare/form/field.rb @@ -60,6 +60,10 @@ module Locmare self.template_dir + self.template_file_name end + def template_option + {:field => self} + end + def row_break_template_dir @form.template_dir + 'row_break/' end diff --git a/lib/manifest/item/base.rb b/lib/manifest/item/base.rb index 6fc61dc1..cfe34ac8 100644 --- a/lib/manifest/item/base.rb +++ b/lib/manifest/item/base.rb @@ -30,7 +30,7 @@ module Manifest def find_boost_name column_name @boost.each do |boost_name, boost_manifest| - return boost_name if boost_manifest.extend_column_name == column_name + return boost_name if boost_manifest.settings_column_name == column_name end nil end diff --git a/public/local_manifest.json b/public/local_manifest.json index 5d877a01..02780a30 100644 --- a/public/local_manifest.json +++ b/public/local_manifest.json @@ -2862,7 +2862,7 @@ "open", "commercial", "official", - "attribution:", + "attribution", "derive", "thumbnail", "gif_convert", diff --git a/spec/controllers/folders_controller_spec.rb b/spec/controllers/folders_controller_spec.rb new file mode 100644 index 00000000..b43fe5c4 --- /dev/null +++ b/spec/controllers/folders_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe FoldersController do + +end diff --git a/spec/helpers/folders_helper_spec.rb b/spec/helpers/folders_helper_spec.rb new file mode 100644 index 00000000..7f196678 --- /dev/null +++ b/spec/helpers/folders_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the FoldersHelper. For example: +# +# describe FoldersHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe FoldersHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/folder_spec.rb b/spec/models/folder_spec.rb new file mode 100644 index 00000000..e8035fd6 --- /dev/null +++ b/spec/models/folder_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Folder do + pending "add some examples to (or delete) #{__FILE__}" +end