From: yasushiito Date: Thu, 19 Dec 2013 23:36:52 +0000 (+0900) Subject: work X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=commitdiff_plain;h=ea8cffd624cffaab06a17dce0c8d78b0917aee64 work --- diff --git a/app/controllers/comics_controller.rb b/app/controllers/comics_controller.rb index f8f0a04f..e8aee01a 100644 --- a/app/controllers/comics_controller.rb +++ b/app/controllers/comics_controller.rb @@ -21,7 +21,6 @@ class ComicsController < ApplicationController @item = Comic.show(params[:id], @operators) respond_to do |format| format.html { - @comic = @item } format_prof format format.json { render json: @item.to_json(Comic.show_json_opt) } diff --git a/app/controllers/scroll_panels_controller.rb b/app/controllers/scroll_panels_controller.rb index f9db91f5..3aab2c6a 100644 --- a/app/controllers/scroll_panels_controller.rb +++ b/app/controllers/scroll_panels_controller.rb @@ -21,9 +21,6 @@ class ScrollPanelsController < ApplicationController @item = ScrollPanel.show(params[:id], @operators) respond_to do |format| - format.html { - @scroll_panel = @item - } format_prof format format.json { render json: @item.scroll_panel_as_json(@operators.author) } end diff --git a/app/controllers/scrolls_controller.rb b/app/controllers/scrolls_controller.rb index 80e40a8d..0bdf6d8b 100644 --- a/app/controllers/scrolls_controller.rb +++ b/app/controllers/scrolls_controller.rb @@ -22,11 +22,9 @@ class ScrollsController < ApplicationController respond_to do |format| format.html { - @scroll = @item if @operators.author - controller = Pettanr::Application::manifest.controller_managers['home'] - @action = controller.open('panels', {:page => 1, :page_size => 5}, @operators) - @new_panels_filer = @action.filer + @new_panel_items = assist_items('panel', 'private_list') + @new_panel_filer = assist_filer 'panel', @new_panel_items end } format.json { render json: @item.to_json(Scroll.show_json_opt) } @@ -37,7 +35,7 @@ class ScrollsController < ApplicationController end def play - @scroll = Scroll.show(params[:id], [@user, @admin]) + @scroll = Scroll.show(params[:id], @operators) cnt = ScrollPanel.count(:conditions => ['scroll_id = ?', @scroll.id]).to_i @offset = ScrollPanel.offset cnt, params[:offset] @panel_count = ScrollPanel.panel_count cnt, params[:count] @@ -62,7 +60,7 @@ class ScrollsController < ApplicationController @new_panels = Panel.mylist(@author, 1, 5) end } - format.json {render text: ScrollPanel.list_as_json_text(@scroll_panels, @author)} + format.json {render text: ScrollPanel.list_as_json_text(@scroll_panels, @operators)} format.jsonp { render :json => "callback(" + @scroll_panels.to_json_list + ");" } diff --git a/app/controllers/sheet_panels_controller.rb b/app/controllers/sheet_panels_controller.rb index 5d512783..81ffc758 100644 --- a/app/controllers/sheet_panels_controller.rb +++ b/app/controllers/sheet_panels_controller.rb @@ -21,9 +21,6 @@ class SheetPanelsController < ApplicationController @item = SheetPanel.show(params[:id], @operators) respond_to do |format| - format.html { - @sheet_panel = @item - } format_prof format format.json { render json: @item.sheet_panel_as_json(@operators.author) } end diff --git a/app/controllers/sheets_controller.rb b/app/controllers/sheets_controller.rb index c6929a9b..d53fbe3b 100644 --- a/app/controllers/sheets_controller.rb +++ b/app/controllers/sheets_controller.rb @@ -22,11 +22,14 @@ class SheetsController < ApplicationController respond_to do |format| format.html { - @sheet = @item if @operators.author - @new_panels = Panel.mylist(@operators.author, 1, 5) - @new_stories = Story.mylist(@operators.author, 1, 5) - @fresh_stories = StorySheet.mylist(@operators.author, 1, 5).map {|ss| ss.story} + @new_panel_items = assist_items('panel', 'private_list') + @new_panel_filer = assist_filer 'panel', @new_panel_items + + @new_story_items = assist_items('story', 'private_list') + @new_story_filer = assist_filer 'story', @new_story_items + @fresh_story_items = assist_items('story_sheet', 'private_list').map {|ss| ss.story} + @fresh_story_filer = assist_filer 'story', @fresh_story_items end } format_prof format diff --git a/app/controllers/speech_balloons_controller.rb b/app/controllers/speech_balloons_controller.rb index 6e95295b..5fba6896 100644 --- a/app/controllers/speech_balloons_controller.rb +++ b/app/controllers/speech_balloons_controller.rb @@ -8,7 +8,6 @@ class SpeechBalloonsController < ApplicationController before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy] before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy] end - before_filter :authenticate_admin!, :only => [:list, :browse] def self.model SpeechBalloon @@ -29,24 +28,6 @@ class SpeechBalloonsController < ApplicationController end end - def list - @speech_balloons = SpeechBalloon.all - - respond_to do |format| - format.html { render layout: 'system' } - format.json { render json: @speech_balloons } - end - end - - def browse - @speech_balloon = SpeechBalloon.find(params[:id]) - - respond_to do |format| - format.html { render layout: 'system' } - format.json { render json: @speech_balloon } - end - end - def new raise Pettanr::NotWork unless @operators.author.working_panel @speech_balloon_template = SpeechBalloonTemplate.show params[:speech_balloon_template_id], @operators @@ -67,9 +48,9 @@ class SpeechBalloonsController < ApplicationController end def edit - @speech_balloon = SpeechBalloon.show(params[:id], @operators.author) + @speech_balloon = SpeechBalloon.show(params[:id], @operators) @speech_balloon_template = @speech_balloon.speech_balloon_template - @panel = Panel.edit(@speech_balloon.panel.id, @operators.author) + @panel = Panel.edit(@speech_balloon.panel.id,@operators) @speech_balloon.boost @@ -83,7 +64,7 @@ class SpeechBalloonsController < ApplicationController def create raise Pettanr::NotWork unless @operators.author.working_panel SpeechBalloon.fold_extend_settings params - @panel = Panel.edit(@operators.author.working_panel, @author) + @panel = Panel.edit(@operators.author.working_panel, @operators) @speech_balloon = SpeechBalloon.new @speech_balloon.attributes = params[:speech_balloon] @@ -95,7 +76,7 @@ class SpeechBalloonsController < ApplicationController @speech_balloon.overwrite @panel.id respond_to do |format| - if @speech_balloon.valid? and @speech_balloon.store(@author, params[:speech_balloon]) + if @speech_balloon.valid? and @speech_balloon.store(@operators, params[:speech_balloon]) flash[:notice] = I18n.t('flash.notice.created', :model => Panel.model_name.human) format.html { redirect_to @panel } format.json { render json: @panel.panel_elements_as_json, status: :created, location: @panel } @@ -111,7 +92,7 @@ class SpeechBalloonsController < ApplicationController def update SpeechBalloon.fold_extend_settings params - @speech_balloon = SpeechBalloon.show(params[:id], @operators.author) + @speech_balloon = SpeechBalloon.show(params[:id], @operators) @speech_balloon.attributes = params[:speech_balloon] @speech_balloon_template = @speech_balloon.speech_balloon_template @@ -119,11 +100,11 @@ class SpeechBalloonsController < ApplicationController params[:speech_balloon][:balloon_attributes][:system_picture_id] = @speech_balloon.get_balloon.select_system_picture - @panel = Panel.edit(@speech_balloon.panel.id, @operators.author) + @panel = Panel.edit(@speech_balloon.panel.id, @operators) @speech_balloon.overwrite @panel.id respond_to do |format| - if @speech_balloon.valid? and @speech_balloon.store(@operators.author, params[:speech_balloon]) + if @speech_balloon.valid? and @speech_balloon.store(@operators, params[:speech_balloon]) flash[:notice] = I18n.t('flash.notice.updated', :model => SpeechBalloon.model_name.human) format.html { redirect_to @speech_balloon } format.json { head :ok } @@ -138,8 +119,8 @@ class SpeechBalloonsController < ApplicationController end def destroy - @speech_balloon = SpeechBalloon.show(params[:id], @operators.author) - @panel = Panel.edit(@speech_balloon.panel.id, @operators.author) + @speech_balloon = SpeechBalloon.show(params[:id], @operators) + @panel = Panel.edit(@speech_balloon.panel.id, @operators) respond_to do |format| if @speech_balloon.remove @operators.author diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index 378a275c..6739413a 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -22,9 +22,9 @@ class StoriesController < ApplicationController respond_to do |format| format.html { - @story = @item if @operators.author - @new_sheets = Sheet.mylist(@operators.author, 1, 5) + @new_sheet_items = assist_items('sheet', 'private_list') + @new_sheet_filer = assist_filer 'sheet', @new_sheet_items end } format_prof format @@ -33,7 +33,7 @@ class StoriesController < ApplicationController end def play - @story = Story.show(params[:id], [@user, @admin]) + @story = Story.show(params[:id], @operators) @page = StorySheet.page params[:page] @sheet = StorySheet.play_sheet(@story, @author, @page) respond_to do |format| diff --git a/app/controllers/story_sheets_controller.rb b/app/controllers/story_sheets_controller.rb index c9762289..150bd1c0 100644 --- a/app/controllers/story_sheets_controller.rb +++ b/app/controllers/story_sheets_controller.rb @@ -21,9 +21,6 @@ class StorySheetsController < ApplicationController @item = StorySheet.show(params[:id], @operators) respond_to do |format| - format.html { - @story_sheet = @item - } format_prof format format.json { render json: @item.to_json(StorySheet.show_json_opt) } end diff --git a/app/models/panel.rb b/app/models/panel.rb index 11ac1120..3acafc8e 100644 --- a/app/models/panel.rb +++ b/app/models/panel.rb @@ -54,7 +54,7 @@ class Panel < Pettanr::Content end def visible? operators - return false unless super + return true if super return true if self.new_record? self.publish? end diff --git a/app/models/speech_balloon.rb b/app/models/speech_balloon.rb index 63764ddb..a46b02df 100644 --- a/app/models/speech_balloon.rb +++ b/app/models/speech_balloon.rb @@ -165,7 +165,7 @@ class SpeechBalloon < Pettanr::Content {:include => {:panel => {:include => {:author => {} }}, :balloon => {}, :speech => {}, :speech_balloon_template => {} }} end - def store au, attr + def store operators, attr if self.new_record? sb = self.panel.speech_balloons.build sb.attributes = attr @@ -177,7 +177,7 @@ class SpeechBalloon < Pettanr::Content break end end - self.panel.store({}, au) + self.panel.store({}, operators) end def remove au diff --git a/app/views/comics/show.html.erb b/app/views/comics/show.html.erb index 9b7a8d60..abc0614f 100644 --- a/app/views/comics/show.html.erb +++ b/app/views/comics/show.html.erb @@ -1,29 +1,29 @@ -<% @page_title = t('.title') + ':' + @comic.title %> +<% @page_title = t('.title') + ':' + @item.title %>

<%= t('.title') %>

<%= notice %>

<%= t_m 'Comic.title' -%>: - <%= link_to h(@comic.title), comic_path(@comic) %> + <%= link_to h(@item.title), comic_path(@item) %>

<%= t_m 'Comic.description' -%>: - <%= h(@comic.description) %> + <%= h(@item.description) %>

<%= t_m 'Comic.visible' -%>: - <%= t_selected_item('comic_visible_items', @comic.visible) %> + <%= t_selected_item('comic_visible_items', @item.visible) %>

<%= t_m 'Comic.author_id' -%>: - <%= link_to h(@comic.author.name), author_path(@comic.author) %> + <%= link_to h(@item.author.name), author_path(@item.author) %>

-<% @comic.stories.each do |story| %> - <% if story.visible? @author -%> +<% @item.stories.each do |story| %> + <% if story.visible? @operators -%>
<%= link_to t('stories.show.t', :t => story.disp_t), story_path(story) %> <%= link_to h(story.title), play_story_path(story) %> @@ -32,23 +32,23 @@ <% end %>

<%= t_m 'Comic.created_at' -%>: - <%= l @comic.created_at %> + <%= l @item.created_at %>

<%= t_m 'Comic.updated_at' -%>: - <%= l @comic.updated_at %> + <%= l @item.updated_at %>

-<% if @comic.own? @operators -%> - <%= link_to t('link.edit'), edit_comic_path(@comic) %> - <%= link_to t('link.destroy'), comic_path(@comic), :method => :delete %> +<% if @item.own? @operators -%> + <%= link_to t('link.edit'), edit_comic_path(@item) %> + <%= link_to t('link.destroy'), comic_path(@item), :method => :delete %>

<%= t('stories.index.new') %>

<% @story = Story.new -%> <% @story.supply_default -%> - <% @story.attributes = {:comic_id => @comic.id} -%> + <% @story.attributes = {:comic_id => @item.id} -%> <%= render 'stories/form' %> <% end %> diff --git a/app/views/ground_colors/_standard.html.erb b/app/views/ground_colors/_standard.html.erb index 35f438f6..d3acc7a0 100644 --- a/app/views/ground_colors/_standard.html.erb +++ b/app/views/ground_colors/_standard.html.erb @@ -1,6 +1,6 @@ <%= t_m 'Panel.caption' -%>: <%= h(panel.caption) %> -<%= render 'panels/body', :panel => panel, :author => author, :spot => spot %> -<%= render 'panels/footer', :panel => panel, :author => author %> +<%= render 'panels/body', :panel => panel, :operators => operators, :spot => spot %> +<%= render 'panels/footer', :panel => panel, :operators => operators %> <%= render 'panels/licensed_pictures', :licensed_pictures => panel.licensed_pictures %> diff --git a/app/views/ground_colors/show.html.erb b/app/views/ground_colors/show.html.erb index 0b9b3d0e..bbd11a03 100644 --- a/app/views/ground_colors/show.html.erb +++ b/app/views/ground_colors/show.html.erb @@ -1,7 +1,7 @@

<%= t('.title') %>

<%= notice %>

-<%= render 'panel_pictures/standard', :panel => @ground_color.panel, :author => @author, :spot => @ground_color %> +<%= render 'panel_pictures/standard', :panel => @ground_color.panel, :operators => @operators, :spot => @ground_color %>

<%= t_m 'GroundColor.caption' -%>: @@ -51,4 +51,4 @@ <%= link_to t('link.edit'), edit_ground_color_path(@ground_color) %> <%= link_to t('link.destroy'), ground_color_path(@ground_color), :method => :delete %> -<%= render 'panels/element_copy', :element => @ground_color, :author => @author %> +<%= render 'panels/element_copy', :element => @ground_color, :operators => @operators %> diff --git a/app/views/ground_pictures/_standard.html.erb b/app/views/ground_pictures/_standard.html.erb index 35f438f6..d3acc7a0 100644 --- a/app/views/ground_pictures/_standard.html.erb +++ b/app/views/ground_pictures/_standard.html.erb @@ -1,6 +1,6 @@ <%= t_m 'Panel.caption' -%>: <%= h(panel.caption) %> -<%= render 'panels/body', :panel => panel, :author => author, :spot => spot %> -<%= render 'panels/footer', :panel => panel, :author => author %> +<%= render 'panels/body', :panel => panel, :operators => operators, :spot => spot %> +<%= render 'panels/footer', :panel => panel, :operators => operators %> <%= render 'panels/licensed_pictures', :licensed_pictures => panel.licensed_pictures %> diff --git a/app/views/ground_pictures/edit.html.erb b/app/views/ground_pictures/edit.html.erb index 40bf68a6..da84ebd4 100644 --- a/app/views/ground_pictures/edit.html.erb +++ b/app/views/ground_pictures/edit.html.erb @@ -2,6 +2,6 @@

<%= notice %>

<%= t('home.index.catch') -%>

-<%= render 'panels/standard', :panel => @panel, :author => @author %> +<%= render 'panels/standard', :panel => @panel, :operators => @operators %>

<%= t('ground_colors.update_color') -%>

<%= render @ground_picture.form_template, :elm => @ground_picture, :no_attr => 0 %> diff --git a/app/views/ground_pictures/show.html.erb b/app/views/ground_pictures/show.html.erb index 47c19f7d..4f5c8ede 100644 --- a/app/views/ground_pictures/show.html.erb +++ b/app/views/ground_pictures/show.html.erb @@ -1,7 +1,7 @@

<%= t('.title') %>

<%= notice %>

-<%= render 'panel_pictures/standard', :panel => @ground_picture.panel, :author => @author, :spot => @ground_picture %> +<%= render 'panel_pictures/standard', :panel => @ground_picture.panel, :operators => @operators, :spot => @ground_picture %>

<%= t_m 'GroundPicture.caption' -%>: @@ -41,4 +41,4 @@ <%= link_to t('link.edit'), edit_ground_picture_path(@ground_picture) %> <%= link_to t('link.destroy'), ground_picture_path(@ground_picture), :method => :delete %> -<%= render 'panels/element_copy', :element => @ground_picture, :author => @author %> +<%= render 'panels/element_copy', :element => @ground_picture, :operators => @operators %> diff --git a/app/views/panel_pictures/_standard.html.erb b/app/views/panel_pictures/_standard.html.erb index 35f438f6..d3acc7a0 100644 --- a/app/views/panel_pictures/_standard.html.erb +++ b/app/views/panel_pictures/_standard.html.erb @@ -1,6 +1,6 @@ <%= t_m 'Panel.caption' -%>: <%= h(panel.caption) %> -<%= render 'panels/body', :panel => panel, :author => author, :spot => spot %> -<%= render 'panels/footer', :panel => panel, :author => author %> +<%= render 'panels/body', :panel => panel, :operators => operators, :spot => spot %> +<%= render 'panels/footer', :panel => panel, :operators => operators %> <%= render 'panels/licensed_pictures', :licensed_pictures => panel.licensed_pictures %> diff --git a/app/views/panel_pictures/edit.html.erb b/app/views/panel_pictures/edit.html.erb index 79fd9bed..624058f5 100644 --- a/app/views/panel_pictures/edit.html.erb +++ b/app/views/panel_pictures/edit.html.erb @@ -2,7 +2,7 @@

<%= notice %>

<%= t('home.index.catch') -%>

-<%= render 'panels/standard', :panel => @panel, :author => @author %> +<%= render 'panels/standard', :panel => @panel, :operators => @operators %>

<%= t('panel_pictures.panel_picture') -%>

<% if @panel_picture.picture and @panel_picture.picture.resource_picture %> diff --git a/app/views/panel_pictures/show.html.erb b/app/views/panel_pictures/show.html.erb index 8b2894d5..cad5618a 100644 --- a/app/views/panel_pictures/show.html.erb +++ b/app/views/panel_pictures/show.html.erb @@ -1,7 +1,7 @@

<%= t '.title' -%>

<%= notice %>

-<%= render 'panel_pictures/standard', :panel => @panel_picture.panel, :author => @author, :spot => @panel_picture %> +<%= render 'panel_pictures/standard', :panel => @panel_picture.panel, :operators => @operators, :spot => @panel_picture %>

<%= t_m 'PanelPicture.caption' -%>: @@ -56,4 +56,4 @@ <%= link_to t('link.edit'), edit_panel_picture_path(@panel_picture) %> <%= link_to t('link.destroy'), panel_picture_path(@panel_picture), :method => :delete %> -<%= render 'panels/element_copy', :element => @panel_picture, :author => @author %> +<%= render 'panels/element_copy', :element => @panel_picture, :operators => @operators %> diff --git a/app/views/panels/_element_copy.html.erb b/app/views/panels/_element_copy.html.erb index 837054d4..4de13700 100644 --- a/app/views/panels/_element_copy.html.erb +++ b/app/views/panels/_element_copy.html.erb @@ -1,11 +1,11 @@ -<% if author and author.working? -%> +<% if operators.author and operators.author.working? -%>

<%= t('panels.element_copy') -%>

<%= t('home.index.catch') -%>

- <%= link_to panel_icon(:object => author.working_panel, :size => 25), panel_path(author.working_panel) %> - <%= link_to author.working_panel.caption, main_app.panel_path(author.working_panel) %> + <%= link_to panel_icon(:object => operators.author.working_panel, :size => 25), panel_path(operators.author.working_panel) %> + <%= link_to operators.author.working_panel.caption, main_app.panel_path(operators.author.working_panel) %> - <%= form_for(author.working_panel) do |f| %> - <%= hidden_field_tag "json", element.copy(author.working_panel).to_json %> + <%= form_for(operators.author.working_panel) do |f| %> + <%= hidden_field_tag "json", element.copy(operators.author.working_panel).to_json %>
<%= submit_tag t('panels.inspire') -%>
diff --git a/app/views/scroll_panels/show.html.erb b/app/views/scroll_panels/show.html.erb deleted file mode 100644 index bdd9edfb..00000000 --- a/app/views/scroll_panels/show.html.erb +++ /dev/null @@ -1,41 +0,0 @@ -

<%= t('.title') %>

-

<%= notice %>

- -

- <%= t_m 'ScrollPanel.scroll_id' -%>: - <%= link_to scroll_icon(:object => @scroll_panel.scroll), scroll_path(@scroll_panel.scroll) %> - <%= link_to h(@scroll_panel.scroll.title), play_scroll_path(@scroll_panel.scroll) %> -

- -

- <%= t_m 'ScrollPanel.panel_id' -%>: - <%= link_to panel_icon(:object => @scroll_panel.panel), panel_path(@scroll_panel.panel) %> -

- -

- <%= t_m 'ScrollPanel.t' -%>: - <%= @scroll_panel.t %> -

- -

- <%= t_m 'ScrollPanel.author_id' -%>: - <%= link_to author_icon(:object => @scroll_panel.author), author_path(@scroll_panel.author) %> - <%= link_to h(@scroll_panel.author.name), author_path(@scroll_panel.author) %> -

- -

- <%= t_m 'ScrollPanel.created_at' -%>: - <%= l @scroll_panel.created_at %> -

- -

- <%= t_m 'ScrollPanel.updated_at' -%>: - <%= l @scroll_panel.updated_at %> -

-<% if @scroll_panel.own? @author -%> - <%= link_to t('link.edit'), edit_scroll_panel_path(@scroll_panel) %> - <%= link_to t('link.destroy'), scroll_panel_path(@scroll_panel), :method => :delete %> -<% end %> - -
-<%= render 'panels/standard', :panel => @scroll_panel.panel, :author => @author %> diff --git a/app/views/scrolls/show.html.erb b/app/views/scrolls/show.html.erb index ac1d9f4e..4c55304e 100644 --- a/app/views/scrolls/show.html.erb +++ b/app/views/scrolls/show.html.erb @@ -1,39 +1,43 @@ -<% @page_title = t('.title') + ':' + @scroll.title %> +<% @page_title = t('.title') + ':' + @item.title %>

<%= t('.title') %>

<%= notice %>

<%= t_m 'Scroll.title' -%>: - <%= link_to h(@scroll.title), play_scroll_path(@scroll) %> + <%= link_to h(@item.title), play_scroll_path(@item) %>

<%= t_m 'Scroll.description' -%>: - <%= h(@scroll.description) %> + <%= h(@item.description) %>

<%= t_m 'Scroll.visible' -%>: - <%= t_selected_item('scroll_visible_items', @scroll.visible) %> + <%= t_selected_item('scroll_visible_items', @item.visible) %>

<%= t_m 'Scroll.author_id' -%>: - <%= link_to h(@scroll.author.name), author_path(@scroll.author) %> + <%= link_to h(@item.author.name), author_path(@item.author) %>

<%= t_m 'Scroll.created_at' -%>: - <%= l @scroll.created_at %> + <%= l @item.created_at %>

<%= t_m 'Scroll.updated_at' -%>: - <%= l @scroll.updated_at %> + <%= l @item.updated_at %>

-<% if @scroll.own? @operators -%> - <%= link_to t('link.edit'), edit_scroll_path(@scroll) %> +<% if @item.own? @operators -%> + <%= link_to t('link.edit'), edit_scroll_path(@item) %>

<%= t('scroll_panels.append.new_panels') -%>

- <%= render 'system/filer', {:filer => @new_panels_filer} %> +
+ <% @new_panel_items.each do |panel| %> + <%= render 'scroll_panels/append_panel', :panel => panel, :scroll => @item, :operators => @operators %> + <% end %> +
<% end %> diff --git a/app/views/sheet_panels/_element.html.erb b/app/views/sheet_panels/_element.html.erb index bc7d448b..77a32df0 100644 --- a/app/views/sheet_panels/_element.html.erb +++ b/app/views/sheet_panels/_element.html.erb @@ -1,6 +1,6 @@
class="sheet_panel" style="top:<%= elm.y %>px; left:<%= elm.x %>px; z-index:<%= elm.z %>;"> <% if elm.panel -%> <%# blocked in panels/body panel = Panel.show elm.panel, author -%> - <%= render 'panels/body', :panel => elm.panel, :author => author, :spot => nil %> + <%= render 'panels/body', :panel => elm.panel, :operators => operators, :spot => nil %> <% end %>
diff --git a/app/views/sheet_panels/show.html.erb b/app/views/sheet_panels/show.html.erb deleted file mode 100644 index 9b2c05fb..00000000 --- a/app/views/sheet_panels/show.html.erb +++ /dev/null @@ -1,56 +0,0 @@ -

<%= t('.title') %>

-

<%= notice %>

- -

- <%= t_m 'SheetPanel.sheet_id' -%>: - <%= link_to sheet_icon(:object => @sheet_panel.sheet), sheet_path(@sheet_panel.sheet) %> - <%= link_to h(@sheet_panel.sheet.caption), play_sheet_path(@sheet_panel.sheet) %> -

- -

- <%= t_m 'SheetPanel.panel_id' -%>: - <%= link_to panel_icon(:object => @sheet_panel.panel), panel_path(@sheet_panel.panel) %> -

- -

- <%= t_m 'SheetPanel.x' -%>: - <%= @sheet_panel.x %> -

- -

- <%= t_m 'SheetPanel.y' -%>: - <%= @sheet_panel.y %> -

- -

- <%= t_m 'SheetPanel.z' -%>: - <%= @sheet_panel.z %> -

- -

- <%= t_m 'SheetPanel.t' -%>: - <%= @sheet_panel.t %> -

- -

- <%= t_m 'SheetPanel.author_id' -%>: - <%= link_to author_icon(:object => @sheet_panel.author), author_path(@sheet_panel.author) %> - <%= link_to h(@sheet_panel.author.name), author_path(@sheet_panel.author) %> -

- -

- <%= t_m 'SheetPanel.created_at' -%>: - <%= l @sheet_panel.created_at %> -

- -

- <%= t_m 'SheetPanel.updated_at' -%>: - <%= l @sheet_panel.updated_at %> -

-<% if @sheet_panel.own? @author -%> - <%= link_to t('link.edit'), edit_sheet_panel_path(@sheet_panel) %> - <%= link_to t('link.destroy'), sheet_panel_path(@sheet_panel), :method => :delete %> -<% end %> - -
-<%= render 'panels/standard', :panel => @sheet_panel.panel, :author => @author %> diff --git a/app/views/sheets/_body.html.erb b/app/views/sheets/_body.html.erb index e1c58dfb..5be0d57a 100644 --- a/app/views/sheets/_body.html.erb +++ b/app/views/sheets/_body.html.erb @@ -1,7 +1,7 @@
<% if sheet.visible? @operators -%> <% sheet.sheet_elements.each do |elm| %> - <%= render elm.class.to_s.tableize + '/element', :elm => elm, :author => author %> + <%= render elm.class.to_s.tableize + '/element', :elm => elm, :operators => operators %> <% end %> <% else %>

<%= t('sheets.hidden') %>

diff --git a/app/views/sheets/_standard.html.erb b/app/views/sheets/_standard.html.erb index ad2f5f4f..094d4fc1 100644 --- a/app/views/sheets/_standard.html.erb +++ b/app/views/sheets/_standard.html.erb @@ -1,9 +1,9 @@ -<%= render 'sheets/body', :sheet => sheet, :author => author %> +<%= render 'sheets/body', :sheet => sheet, :operators => operators %>
<% sheet.sheet_elements.each do |sheet_panel| %> - <%= render 'sheet_panels/play_footer', :sheet_panel => sheet_panel, :author => author %> + <%= render 'sheet_panels/play_footer', :sheet_panel => sheet_panel, :operators => operators %> <% end %> - <%= render 'sheet_panels/licensed_pictures', :licensed_pictures => @sheet.licensed_pictures %> + <%= render 'sheet_panels/licensed_pictures', :licensed_pictures => sheet.licensed_pictures %>
diff --git a/app/views/sheets/show.html.erb b/app/views/sheets/show.html.erb index 5caa8e9f..45366b50 100644 --- a/app/views/sheets/show.html.erb +++ b/app/views/sheets/show.html.erb @@ -1,15 +1,15 @@ -<% @page_caption = t('.title') + ':' + @sheet.caption %> +<% @page_caption = t('.title') + ':' + @item.caption %>

<%= t('.title') %>

<%= notice %>

-<%= render 'standard', :sheet => @sheet, :author => @author %> +<%= render 'standard', :sheet => @item, :operators => @operators %> -<% if @author %> - <% if @sheet.copyable? %> +<% if @operators.author %> + <% if @item.copyable? %>

<%= t('sheets.show.copy') -%>

<%= form_for(Sheet.new, :html => {:jqform => 'pettanr-sheet-form'}) do |f| %> - <%= hidden_field_tag "json", @sheet.copy().to_json %> + <%= hidden_field_tag "json", @item.copy().to_json %>
<%= submit_tag t('sheets.show.inspire') -%>
@@ -17,26 +17,26 @@ <% end %> <% end %> -<% if @sheet.own? @author %> - <%= link_to t('link.edit'), edit_sheet_path(@sheet) %> - <%= link_to t('link.destroy'), sheet_path(@sheet), :method => :delete %> +<% if @item.own? @operators %> + <%= link_to t('link.edit'), edit_sheet_path(@item) %> + <%= link_to t('link.destroy'), sheet_path(@item), :method => :delete %>

<%= t('sheet_panels.append.new_panels') -%>

- <% @new_panels.each do |panel| %> - <%= render 'sheet_panels/append_panel', :sheet => @sheet, :panel => panel, :author => @author %> + <% @new_panel_items.each do |panel| %> + <%= render 'sheet_panels/append_panel', :sheet => @item, :panel => panel, :operators => @operators %> <% end %>

<%= t('story_sheets.append.new_stories') -%>

- <% @new_stories.each do |story| %> - <%= render 'story_sheets/append_story', :sheet => @sheet, :story => story, :author => @author %> + <% @new_story_items.each do |story| %> + <%= render 'story_sheets/append_story', :sheet => @item, :story => story, :operators => @operators %> <% end %>

<%= t('story_sheets.append.fresh_stories') -%>

- <% @fresh_stories.each do |story| %> - <%= render 'story_sheets/append_story', :sheet => @sheet, :story => story, :author => @author %> + <% @fresh_story_items.each do |story| %> + <%= render 'story_sheets/append_story', :sheet => @item, :story => story, :operators => @operators %> <% end %>
<% end %> diff --git a/app/views/speech_balloons/_standard.html.erb b/app/views/speech_balloons/_standard.html.erb index 35f438f6..d3acc7a0 100644 --- a/app/views/speech_balloons/_standard.html.erb +++ b/app/views/speech_balloons/_standard.html.erb @@ -1,6 +1,6 @@ <%= t_m 'Panel.caption' -%>: <%= h(panel.caption) %> -<%= render 'panels/body', :panel => panel, :author => author, :spot => spot %> -<%= render 'panels/footer', :panel => panel, :author => author %> +<%= render 'panels/body', :panel => panel, :operators => operators, :spot => spot %> +<%= render 'panels/footer', :panel => panel, :operators => operators %> <%= render 'panels/licensed_pictures', :licensed_pictures => panel.licensed_pictures %> diff --git a/app/views/speech_balloons/show.html.erb b/app/views/speech_balloons/show.html.erb index 998ee303..f7f0755c 100644 --- a/app/views/speech_balloons/show.html.erb +++ b/app/views/speech_balloons/show.html.erb @@ -1,7 +1,7 @@

<%= t('.title') %>

<%= notice %>

-<%= render 'speech_balloons/standard', :panel => @speech_balloon.panel, :author => @author, :spot => @speech_balloon %> +<%= render 'speech_balloons/standard', :panel => @speech_balloon.panel, :operators => @operators, :spot => @speech_balloon %>

<%= t_m 'SpeechBalloon.caption' -%>: @@ -95,4 +95,4 @@ <%= link_to t('link.edit'), edit_speech_balloon_path(@speech_balloon) %> <%= link_to t('link.destroy'), speech_balloon_path(@speech_balloon), :method => :delete %> -<%= render 'panels/element_copy', :element => @speech_balloon, :author => @author %> +<%= render 'panels/element_copy', :element => @speech_balloon, :operators => @operators %> diff --git a/app/views/stories/show.html.erb b/app/views/stories/show.html.erb index ad03496e..6f9cc265 100644 --- a/app/views/stories/show.html.erb +++ b/app/views/stories/show.html.erb @@ -3,36 +3,36 @@

<%= t_m 'Story.comic_id' -%>: - <%= link_to comic_icon(:object => @story.comic), comic_path(@story.comic) %> - <%= link_to h(@story.comic.title), comic_path(@story.comic) %> + <%= link_to comic_icon(:object => @item.comic), comic_path(@item.comic) %> + <%= link_to h(@item.comic.title), comic_path(@item.comic) %>

- <%= link_to t('stories.show.t', :t => @story.disp_t), story_path(@story) %> - <%= link_to_if @story, h(@story.title), play_story_path(@story) %> + <%= link_to t('stories.show.t', :t => @item.disp_t), story_path(@item) %> + <%= link_to_if @item, h(@item.title), play_story_path(@item) %>

<%= t_m 'Story.description' -%>: - <%= h(@story.description) %> + <%= h(@item.description) %>

<%= t_m 'Story.visible' -%>: - <%= t_selected_item('story_visible_items', @story.visible) %> + <%= t_selected_item('story_visible_items', @item.visible) %>

<%= t_m 'Story.created_at' -%>: - <%= l @story.created_at %> + <%= l @item.created_at %>

<%= t_m 'Story.updated_at' -%>: - <%= l @story.updated_at %> + <%= l @item.updated_at %>

-<% @story.story_sheets.each do |story_sheet| %> - <% if story_sheet.sheet and story_sheet.sheet.visible?(@author) -%> +<% @item.story_sheets.each do |story_sheet| %> + <% if story_sheet.sheet and story_sheet.sheet.visible?(@operators) -%>
<%= link_to sheet_icon(:object => story_sheet.sheet, :size => 25), sheet_path(story_sheet.sheet) %> <%= link_to h(truncate(story_sheet.sheet.caption, :length => 40)), play_sheet_path(story_sheet.sheet) %> @@ -40,14 +40,14 @@
<% end %> <% end %> -<% if @story.own? @author -%> - <%= link_to t('link.edit'), edit_story_path(@story) %> - <%= link_to t('link.destroy'), story_path(@story), :method => :delete %> +<% if @item.own? @operators -%> + <%= link_to t('link.edit'), edit_story_path(@item) %> + <%= link_to t('link.destroy'), story_path(@item), :method => :delete %>

<%= t('story_sheets.append.new_sheets') -%>

- <% @new_sheets.each do |sheet| %> - <%= render 'story_sheets/append_sheet', :story => @story, :sheet => sheet, :author => @author %> + <% @new_sheet_items.each do |sheet| %> + <%= render 'story_sheets/append_sheet', :story => @item, :sheet => sheet, :operators => @operators %> <% end %>
<% end %> diff --git a/app/views/story_sheets/_append_story.html.erb b/app/views/story_sheets/_append_story.html.erb index eeda46f2..35ea0b55 100644 --- a/app/views/story_sheets/_append_story.html.erb +++ b/app/views/story_sheets/_append_story.html.erb @@ -8,7 +8,7 @@ <%= distance_of_time_in_words_to_now story.updated_at %> - <% if story.own? author %> + <% if story.own? operators %> <% @story_sheet = StorySheet.new :story_id => story.id, :sheet_id => sheet.id %> <%= form_for(@story_sheet) do |f| %> <%= f.hidden_field :story_id %> diff --git a/app/views/story_sheets/show.html.erb b/app/views/story_sheets/show.html.erb deleted file mode 100644 index c21cf120..00000000 --- a/app/views/story_sheets/show.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -

<%= t('.title') %>

-

<%= notice %>

- -

- <%= t_m 'StorySheet.story_id' -%>: - <%= link_to story_icon(:object => @story_sheet.story), story_path(@story_sheet.story) %> - <%= link_to h(@story_sheet.story.title), play_story_path(@story_sheet.story) %> -

- -

- <%= t_m 'StorySheet.sheet_id' -%>: - <%= link_to sheet_icon(:object => @story_sheet.sheet), sheet_path(@story_sheet.sheet) %> -

- -

- <%= t_m 'StorySheet.t' -%>: - <%= @story_sheet.t %> -

- -

- <%= t_m 'StorySheet.author_id' -%>: - <%= link_to author_icon(:object => @story_sheet.author), author_path(@story_sheet.author) %> - <%= link_to h(@story_sheet.author.name), author_path(@story_sheet.author) %> -

- -

- <%= t_m 'StorySheet.created_at' -%>: - <%= l @story_sheet.created_at %> -

- -

- <%= t_m 'StorySheet.updated_at' -%>: - <%= l @story_sheet.updated_at %> -

-<% if @story_sheet.own? @author -%> - <%= link_to t('link.edit'), edit_story_sheet_path(@story_sheet) %> - <%= link_to t('link.destroy'), story_sheet_path(@story_sheet), :method => :delete %> -<% end %> - diff --git a/lib/manifest/filer.rb b/lib/manifest/filer.rb index 21d94d73..e49d3706 100644 --- a/lib/manifest/filer.rb +++ b/lib/manifest/filer.rb @@ -83,14 +83,17 @@ module Pettanr end def render view, item, operators - link = self.__send__(@link_method_name, view, item, operators) - tag = self.__send__(@tag_method_name, view, item, operators) - unless tag.blank? - view.link_to_unless link.blank?, tag, link + if @tag_method_name == :tag_template + view.render item.path_name + '/' + @symbol_conf['name'], :item => item + else + link = self.__send__(@link_method_name, view, item, operators) + tag = self.__send__(@tag_method_name, view, item, operators) + unless tag.blank? + view.link_to_unless link.blank?, tag, link + end end end - end class Caption @@ -126,6 +129,8 @@ module Pettanr :tag_column when 'method' :tag_method + when 'none' + :tag_none else :tag_else end @@ -164,7 +169,7 @@ module Pettanr end def visible? - self.link_method_name != :link_none + @tag_method_name != :tag_none end def render view, item, operators diff --git a/lib/manifest/form.rb b/lib/manifest/form.rb index 74bd8652..489551f2 100644 --- a/lib/manifest/form.rb +++ b/lib/manifest/form.rb @@ -4,7 +4,7 @@ module Pettanr class Form end - attr :form_manifest, :item_name, :manifest, :form_conf, + attr :form_manifest, :item_name, :manifest, :form_conf def initialize form_manifest @form_manifest = form_manifest @item_name = @form_manifest.item_name