range: [0, 0xffffff],\r
}\r
},\r
+ orientation: {\r
+ type: 'number',\r
+ rules : {\r
+ required: true,\r
+ number: true,\r
+ range: [0, 1],\r
+ }\r
+ },\r
+ xy: {\r
+ type: 'number',\r
+ rules : {\r
+ number: true,\r
+ }\r
+ },\r
+ wh: {\r
+ type: 'number',\r
+ rules : {\r
+ number: true,\r
+ }\r
+ },\r
z: {\r
type: 'number',\r
rules : {\r
column: 'picture_id',\r
type: 'hidden',\r
label: {\r
- type: 'hidden'\r
},\r
+ helpers: {\r
+ popup: {\r
+ path: 'panels/popup_helper',\r
+ source: 'pictures',\r
+ options: {\r
+ }\r
+ }\r
+ }\r
options: {\r
}\r
},\r
}\r
},\r
},\r
+ orientation: {\r
+ column: 'orientation',\r
+ type: 'select',\r
+ label: {\r
+ },\r
+ options: {\r
+ source: 'magic_number',\r
+ key: 'ground_color_orientation_items',\r
+ row_break: true\r
+ }\r
+ },\r
+ xy: {\r
+ column: 'xy',\r
+ type: 'number',\r
+ label: {\r
+ },\r
+ options: {\r
+ size: 5, \r
+ }\r
+ },\r
+ wh: {\r
+ column: 'wh',\r
+ type: 'number',\r
+ label: {\r
+ },\r
+ options: {\r
+ size: 5, \r
+ row_break: true\r
+ }\r
+ },\r
z: {\r
column: 'z',\r
type: 'hidden',\r
'panel_id',\r
'caption',\r
'code',\r
+ 'orientation',\r
+ 'xy',\r
+ 'wh',\r
'z',\r
't',\r
]\r
--- /dev/null
+class PettanrPopupHelper\r
+ confirm_confirm_confirm = () ->\r
+ confirm( )\r
+ \r
+ @speech_balloon_tag_id = (element_part) ->\r
+ window.PettanrEditor.element_tag_id(element_part)\r
+ \r
+ @speech_balloon_template_id = (element_part) ->\r
+ trace = PettanrBalloonRHelper.speech_balloon_tag_id(element_part)\r
+ parseInt($(trace + 'speech_balloon_template_id').val())\r
+ \r
+ @template_class = (element_part) ->\r
+ id = PettanrBalloonRHelper.speech_balloon_template_id(element_part)\r
+ engine_name = window.PettanrSpeechBalloonTemplate.speech_balloon_templates[id]\r
+ window.PettanrSpeechBalloonTemplate.scripts[engine_name]\r
+ \r
+ @settings = (element_part) ->\r
+ id = PettanrBalloonRHelper.speech_balloon_template_id(element_part)\r
+ window.PettanrSpeechBalloonTemplate.settings(id)\r
+ \r
+ @r_step = (element_part) ->\r
+ settings = PettanrBalloonRHelper.settings(element_part)\r
+ settings['speech_balloon']['r_step']\r
+ \r
+ @system_picture_id = (element_part, idx) ->\r
+ settings = PettanrBalloonRHelper.settings(element_part)\r
+ settings[idx]['balloon']['system_picture_id']\r
+ \r
+ # \r
+ @add_helper = () ->\r
+ editor = window.PettanrEditor\r
+ \r
+ $('.popup').map -> \r
+ panel = $(editor.panel_tag_id($(@)))\r
+ if editor.is_editable(panel)\r
+ $(@).html('<button>...</button>')\r
+ trace = editor.panel_tag_id($(@))\r
+ popup = $(trace + 'popup')\r
+ popup.dialog {\r
+ autoOpen: false,\r
+ modal: true,\r
+ }\r
+ $('button', $(@)).map -> \r
+ $(@).click -> \r
+ trace = editor.panel_tag_id($(@).parent())\r
+ popup = $(trace + 'popup')\r
+ popup.attr('data-value', '')\r
+ popup.dialog('open')\r
+ \r
+ else\r
+ $(@).css('display', 'none')\r
+ \r
+ \r
+ \r
+@PettanrPopupHelper = PettanrPopupHelper\r
v.add_helper( n, '' )\r
PictureSizeHelper = window.PettanrPictureSizeHelper\r
ColorHelper = window.PettanrColorHelper\r
+ PopupHelper = window.PettanrPopupHelper\r
\r
#panel = new Panel\r
#pp = new PanelPicture\r
if Object.keys(rules).length > 0\r
v = form.validate({ignore:[],rules: rules})\r
\r
+ display_panel = (panel, vis) ->\r
+ v = if vis\r
+ ''\r
+ else\r
+ 'none'\r
+ trace = editor.panel_tag_id(panel)\r
+ $(trace).css('display', v)\r
+ \r
validate_panel = (form) ->\r
valid = form.valid()\r
bc = if valid\r
'#ef29ef'\r
$('a', $('#tabs-1-tab')).map ->\r
$(@).css('background-color', bc)\r
+ display_panel(form, valid)\r
valid\r
\r
display_element = (element, vis) ->\r
- v = if vis\r
+ trace = editor.element_tag_id(element)\r
+ d = $(trace + '_destroy').val()\r
+ v = if vis and d.length < 1\r
''\r
else\r
'none'\r
- trace = editor.element_tag_id(element)\r
switch element.attr('element_type')\r
when 'panel_picture'\r
trace = trace + 'div'\r
\r
# panel picture\r
PictureSizeHelper.add_helper()\r
+ PopupHelper.add_helper()\r
\r
$('.pettanr-panel-picture-wrapper').map ->\r
$(@).draggable {\r
\r
\r
# ground-picture\r
+ refresh_ground_picture = (element_trace) ->\r
+ x = parseInt($(element_trace + 'x').val()).toString() + 'px'\r
+ y = parseInt($(element_trace + 'y').val()).toString() + 'px'\r
+ $(element_trace).css('background-position', x + ' ' + y)\r
+ \r
# sync view \r
$('input').map ->\r
if editor.element_is('ground_picture', $(@))\r
- $(@).focusout ->\r
- switch $(@).attr('column')\r
- when 'x', 'y'\r
+ switch $(@).attr('column')\r
+ when 'x', 'y'\r
+ $(@).focusout ->\r
trace = editor.element_tag_id($(@))\r
- x = parseInt($(trace + 'x').val()).toString() + 'px'\r
- y = parseInt($(trace + 'y').val()).toString() + 'px'\r
- $(trace).css('background-position', x + ' ' + y)\r
+ refresh_ground_picture(trace)\r
+ $(@).spinner {\r
+ stop: ( event, ui ) ->\r
+ trace = editor.element_tag_id($(@))\r
+ refresh_ground_picture(trace)\r
+ }\r
$('select').map ->\r
if editor.element_is('ground_picture', $(@))\r
$(@).change ->\r
# ground_color\r
ColorHelper.add_helper($('.ground_color-code-wrap'), 'code')\r
\r
+ refresh_ground_color = (element_trace) ->\r
+ orientation = parseInt( $(element_trace + 'orientation').val() )\r
+ xy = $(element_trace + 'xy').val()\r
+ wh = $(element_trace + 'wh').val()\r
+ div_offset = if xy\r
+ xy\r
+ else\r
+ 0\r
+ div_size = if wh\r
+ wh\r
+ else\r
+ 100 - div_offset\r
+ div_x = if orientation == 0\r
+ 0\r
+ else\r
+ div_offset\r
+ div_y = if orientation == 0\r
+ div_offset\r
+ else\r
+ 0\r
+ div_width = if orientation == 0\r
+ 100\r
+ else\r
+ div_size\r
+ div_height = if orientation == 0\r
+ div_size\r
+ else\r
+ 100\r
+ div = $(element_trace)\r
+ div.css('left', div_x.toString() + '%')\r
+ div.css('top', div_y.toString() + '%')\r
+ div.css('width', div_width.toString() + '%')\r
+ div.css('height', div_height.toString() + '%')\r
+ \r
# sync view \r
$('input').map ->\r
if editor.element_is('ground_color', $(@))\r
- if $(@).attr('column') == 'code'\r
- $(@).hide()\r
+ switch $(@).attr('column')\r
+ when 'code'\r
+ $(@).hide()\r
+ when 'xy', 'wh'\r
+ $(@).spinner {\r
+ stop: ( event, ui ) ->\r
+ trace = editor.element_tag_id($(@))\r
+ refresh_ground_color(trace)\r
+ , min: 0\r
+ , max: 100\r
+ }\r
+ $(@).focusout ->\r
+ trace = editor.element_tag_id($(@))\r
+ refresh_ground_color(trace)\r
+ \r
+ $('select').map ->\r
+ if editor.element_is('ground_color', $(@))\r
+ switch $(@).attr('column')\r
+ when 'orientation'\r
+ $(@).change ->\r
+ trace = editor.element_tag_id($(@))\r
+ refresh_ground_color(trace)\r
\r
update_t = (ultrace) -> \r
t = 0\r
respond_to do |format|
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render :json => @ar.to_json(Artist.show_json_opt) }
end
end
respond_to do |format|
format.html
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render :json => @au.to_json(Author.show_json_opt) }
end
end
@balloon = Balloon.show(params[:id], [@user, @admin])
respond_to do |format|
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @balloon.to_json(Balloon.show_json_opt) }
end
end
respond_to do |format|
format.html
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @comic.to_json(Comic.show_json_opt) }
format.atom
format.rss
@ground_color = GroundColor.show(params[:id], [@user, @admin])
respond_to do |format|
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @ground_color.to_json(GroundColor.show_json_opt) }
end
end
@ground_picture = GroundPicture.show(params[:id], [@user, @admin])
respond_to do |format|
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @ground_picture.to_json(GroundPicture.show_json_opt) }
end
end
@license_group = LicenseGroup.show(params[:id])
respond_to do |format|
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @license_group.to_json(LicenseGroup.show_json_opt) }
end
end
@license = License.show(params[:id])
respond_to do |format|
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @license.to_json(License.show_json_opt) }
end
end
@original_picture_license_group = OriginalPictureLicenseGroup.new :original_picture_id => @original_picture.id
render
}
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @original_picture.to_json(OriginalPicture.show_json_opt)}
end
end
respond_to do |format|
format.html
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render :json => @panel_picture.to_json(PanelPicture.show_json_opt) }
end
end
@fresh_sheets = SheetPanel.mylist(@author, 1, 5).map {|sp| sp.sheet}
end
}
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @panel.panel_elements_as_json }
format.jsonp {
render :json => "callback(" + @panel.panel_elements_as_json + ");"
format.gif { send_data(@picture.restore(params[:subdir]), opt ) }
format.jpeg { send_data(@picture.restore(params[:subdir]), opt ) }
format.html
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render :json => @picture.to_json}
end
end
format.gif { send_data(@resource_picture.restore(params[:subdir]), opt ) }
format.jpeg { send_data(@resource_picture.restore(params[:subdir]), opt ) }
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render :json => @resource_picture.to_json(ResourcePicture.show_json_opt)}
end
end
respond_to do |format|
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @scroll_panel.scroll_panel_as_json(@author) }
end
end
end
}
format.json { render json: @scroll.to_json(Scroll.show_json_opt) }
+ format.prof { render :template => 'top/prof', :layout => true }
format.atom
format.rss
end
respond_to do |format|
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @sheet_panel.sheet_panel_as_json(@author) }
end
end
@fresh_stories = StorySheet.mylist(@author, 1, 5).map {|ss| ss.story}
end
}
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @sheet.to_json(Sheet.show_json_opt) }
format.atom
format.rss
respond_to do |format|
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json {
render :json => @speech_balloon_template.to_json(SpeechBalloonTemplate.show_json_opt)
}
@speech_balloon = SpeechBalloon.show(params[:id], [@user, @admin])
respond_to do |format|
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @speech_balloon.to_json(SpeechBalloon.show_json_opt) }
end
end
@speech = Speech.show(params[:id], [@user, @admin])
respond_to do |format|
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @speech.to_json(Speech.show_json_opt) }
end
end
@new_sheets = Sheet.mylist(@author, 1, 5)
end
}
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @story.to_json(Story.show_json_opt) }
end
end
respond_to do |format|
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @story_sheet.to_json(StorySheet.show_json_opt) }
end
end
format.gif { send_data(@system_picture.restore, opt ) }
format.jpeg { send_data(@system_picture.restore, opt ) }
format.html # show.html.erb
+ format.prof { render :template => 'top/prof', :layout => true }
format.json { render json: @system_picture.to_json(SystemPicture.show_json_opt)}
end
end
t(MagicNumber[name][index][0])
end
+ def item_tag
+ tag :img, :src => asset_path('item.png'), :width => 35, :height => 35
+ end
+
def icon_tag name, opt = {}
title = opt[:object] ? (name.to_s + ' ID:' + opt[:object].id.to_s) : name
size = opt[:size] ? opt[:size].to_i : 35
},
"caption": {
"type": "text",
- "rules": {
- }
+ "rules": {}
},
"publish": {
"type": "number",
]
}
},
+ "orientation": {
+ "type": "number",
+ "rules": {
+ "required": true,
+ "number": true,
+ "range": [
+ 0,
+ 1
+ ]
+ }
+ },
+ "xy": {
+ "type": "number",
+ "rules": {
+ "number": true
+ }
+ },
+ "wh": {
+ "type": "number",
+ "rules": {
+ "number": true
+ }
+ },
"z": {
"type": "number",
"rules": {
"picture_id": {
"column": "picture_id",
"type": "hidden",
- "label": {
- "type": "hidden"
+ "label": {},
+ "helpers": {
+ "popup": {
+ "path": "panels/popup_helper",
+ "source": "pictures",
+ "options": {}
+ }
},
"options": {}
},
}
}
},
+ "orientation": {
+ "column": "orientation",
+ "type": "select",
+ "label": {},
+ "options": {
+ "source": "magic_number",
+ "key": "ground_color_orientation_items",
+ "row_break": true
+ }
+ },
+ "xy": {
+ "column": "xy",
+ "type": "number",
+ "label": {},
+ "options": {
+ "size": 5
+ }
+ },
+ "wh": {
+ "column": "wh",
+ "type": "number",
+ "label": {},
+ "options": {
+ "size": 5,
+ "row_break": true
+ }
+ },
"z": {
"column": "z",
"type": "hidden",
"panel_id",
"caption",
"code",
+ "orientation",
+ "xy",
+ "wh",
"z",
"t"
]
validates :panel_id, :numericality => {:allow_blank => true}
validates :code, :presence => true, :numericality => {:greater_than_or_equal_to => 0, :less_than => 0x1000000}
+ validates :orientation, :presence => true, :numericality => true, :inclusion => {:in => 0..1}
+ validates :xy, :numericality => {:greater_than_or_equal_to => 0, :allow_blank => true}
+ validates :wh, :numericality => {:greater_than_or_equal_to => 0, :allow_blank => true}
validates :z, :presence => true, :numericality => {:greater_than => 0}
validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
self.panel.visible? roles
end
+ def div_offset
+ xy ? xy : 0
+ end
+
+ def div_size
+ wh ? wh : 100 - self.div_offset
+ end
+
+ def div_x
+ if self.orientation == 0
+ 0
+ else
+ self.div_offset
+ end
+ end
+
+ def div_y
+ if self.orientation == 0
+ self.div_offset
+ else
+ 0
+ end
+ end
+
+ def div_width
+ if self.orientation == 0
+ 100
+ else
+ self.div_size
+ end
+ end
+
+ def div_height
+ if self.orientation == 0
+ self.div_size
+ else
+ 100
+ end
+ end
+
def opt_div_style spot = nil, opacity = 20
o = (spot and spot != self) ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : ''
- "position: absolute; width:#{self.get_panel.width}px; height:#{self.get_panel.height}px; z-index:#{self.z}; background-color:##{format("%06x", self.code)}; #{o}"
+ "position: absolute; left:#{self.div_x}%; top:#{self.div_y}%; width:#{self.div_width}%; height:#{self.div_height}%; z-index:#{self.z}; background-color:##{format("%06x", self.code)}; #{o}"
end
def boost
Sheet.transaction do
self.sheet_elements.each do |elm|
elm.new_sheet = self
+ elm.boost au
end
res = self.save
unless validate_child
r
end
+ def copyable?
+ r = true
+ Sheet.each_element_class_names do |n|
+ self.elements_by_class_name(n).each do |elm|
+ next if elm.copyable?
+ r = false
+ break
+ end
+ break unless r
+ end
+ r
+ end
+
def copy
attr = self.copy_attributes
Sheet.each_element_class_names do |n|
- attr.merge! Sheet.class_name_to_class(n).panelize(self.elements_by_class_name(n).map {|elm| elm.copy_attributes})
+ element_attr = Sheet.class_name_to_class(n).panelize(
+ self.elements_by_class_name(n).map {|elm|
+ elm.copy_attributes.merge elm.panel_attributes
+ }
+ )
+ attr.merge! element_attr
end
attr
end
belongs_to :author
belongs_to :panel
belongs_to :sheet
+ accepts_nested_attributes_for :panel, :allow_destroy => true
validates :sheet_id, :numericality => {:allow_blank => true}
validates :panel_id, :numericality => {:allow_blank => true}
r = self.attributes
r.delete 'id'
r.delete 'sheet_id'
+ r.delete 'panel_id' # create panel
r.delete 'created_at'
r.delete 'updated_at'
r
end
-
+
+ def copyable?
+ if self.panel and self.panel.publish? == false
+ false
+ else
+ true
+ end
+ end
+
+ def boost au
+ if self.panel
+ self.panel.author_id = au.id
+ self.panel.panel_elements.each do |elm|
+ elm.new_panel = self
+ elm.boost
+ end
+ end
+ end
+
+ def panel_attributes
+ if self.panel
+ {'panel_attributes' => self.panel.copy}
+ else
+ {}
+ end
+ end
+
def self.new_t sheet_id
r = SheetPanel.max_t(sheet_id)
r.blank? ? 0 : r.to_i + 1
<tr>
<td>
+ <%= link_to item_tag, comic_path(comic, :format => :prof) %>
<%= link_to comic_icon(:object => comic, :size => 25), comic_path(comic) %>
<%= link_to h(truncate(comic.title, :length => 40)), comic_path(comic) %>
(<%= comic.stories.size -%>)
--- /dev/null
+<% @page_title = t('.title') + ':' + @comic.title %>
+<h1><%= t('.title') %></h1>
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b><%= t_m 'Comic.title' -%>:</b>
+ <%= link_to h(@comic.title), comic_path(@comic) %>
+</p>
+
+<p>
+ <b><%= t_m 'Comic.description' -%>:</b>
+ <%= h(@comic.description) %>
+</p>
+
+<p>
+ <b><%= t_m 'Comic.visible' -%>:</b>
+ <%= t_selected_item('comic_visible_items', @comic.visible) %>
+</p>
+
+<p>
+ <b><%= t_m 'Comic.author_id' -%>:</b>
+ <%= link_to h(@comic.author.name), author_path(@comic.author) %>
+</p>
+
+<% @comic.stories.each do |story| %>
+ <% if story.visible? @author -%>
+ <div>
+ <%= link_to t('stories.show.t', :t => story.disp_t), story_path(story) %>
+ <%= link_to h(story.title), play_story_path(story) %>
+ </div>
+ <% end %>
+<% end %>
+<p>
+ <b><%= t_m 'Comic.created_at' -%>:</b>
+ <%= l @comic.created_at %>
+</p>
+
+<p>
+ <b><%= t_m 'Comic.updated_at' -%>:</b>
+ <%= l @comic.updated_at %>
+</p>
+
+<% if @comic.own? @author -%>
+ <%= link_to t('link.edit'), edit_comic_path(@comic) %>
+ <%= link_to t('link.destroy'), comic_path(@comic), :method => :delete %>
+
+ <h2>
+ <%= t('stories.index.new') %>
+ </h2>
+ <% @story = Story.new -%>
+ <% @story.supply_default -%>
+ <% @story.attributes = {:comic_id => @comic.id} -%>
+<% end %>
<div class="row_break">
</div>
<div class="field">
+ <%= f.label :orientation %>
+ <%= f.collection_select :orientation, t_select_items(MagicNumber['ground_color_orientation_items']), :last, :first, :html => {:selected => elm.orientation} %>
+
+ <%= f.label :xy %>
+ <%= f.number_field :xy, elm.field_tag_attributes(:xy, no_attr, :size => 5) %>
+
+ <%= f.label :wh %>
+ <%= f.number_field :wh, elm.field_tag_attributes(:wh, no_attr, :size => 5) %>
+ </div>
+ <div class="row_break">
+ </div>
+ <div class="field">
<%= f.label :z %>
<%= f.number_field :z, elm.field_tag_attributes(:z, no_attr, :size => 5) %>
</div>
</p>
<p>
+ <b><%= t_m 'GroundColor.orientation' -%>:</b>
+ <%= t_selected_item('ground_color_orientation_items', @ground_color.orientation) %>
+</p>
+
+<p>
+ <b><%= t_m 'GroundColor.xy' -%>:</b>
+ <%= @ground_color.xy %>
+</p>
+
+<p>
+ <b><%= t_m 'GroundColor.wh' -%>:</b>
+ <%= @ground_color.wh %>
+</p>
+
+<p>
<b><%= t_m 'GroundColor.z' -%>:</b>
<%= @ground_color.z %>
</p>
--- /dev/null
+<!DOCTYPE html>\r
+<html>\r
+<head>\r
+ <title>\r
+ <% if @page_title %>\r
+ <%= h @page_title %>\r
+ <% else %>\r
+ <%= t("#{params[:controller]}.#{params[:action]}.title") %>\r
+ <% end %>\r
+ - <%= h(MagicNumber['profile']['users']['caption']) %>\r
+ </title>\r
+ <%= stylesheet_link_tag "application" %>\r
+ <%= javascript_include_tag "application" %>\r
+ <%= raw panel_editor_javascript_include_tags %>\r
+ <%= csrf_meta_tags %>\r
+</head>\r
+<body>\r
+\r
+<div width="100%">\r
+<table class="no-border">\r
+ <tr>\r
+ <td width="50%">\r
+ <h3><%= link_to MagicNumber['profile']['users']['caption'], main_app.root_path %></h3>\r
+ </td>\r
+ <td width="30%">\r
+ <% if user_signed_in? %>\r
+ <%# link_to t('top.metro.title'), '/top/metro' %>\r
+ <% end %>\r
+ </td>\r
+ <td>\r
+ <div>\r
+ <% if @author %>\r
+ <%= link_to h(truncate(@author.name, :length => 12)), main_app.author_path(@author) %>\r
+ <% end %>\r
+ </div>\r
+ <div>\r
+ <% if @artist %>\r
+ <%= link_to h(truncate(@artist.name, :length => 12)), main_app.artist_path(@artist) %>\r
+ <% end %>\r
+ </div>\r
+ </td>\r
+ <td>\r
+ <% if user_signed_in? %>\r
+ <%= link_to t('home.configure.title'), '/home/configure' %>\r
+ <%= link_to t('home.sign_out.title'), main_app.destroy_user_session_path, :method => :delete %>\r
+ <% else %>\r
+ <%= link_to "sign in", main_app.new_user_session_path %>\r
+ <% end %>\r
+ </td>\r
+ </tr>\r
+</table>\r
+</div>\r
+<%= yield %>\r
+<div width="100%" style="background-color: #faddfa; padding: 5px;">\r
+ <%= link_to t('tab.demander.title'), main_app.demanders_path %>\r
+ <% if demand_user_signed_in? %>\r
+ <%= link_to t_m('Demander'), main_app.demanders_path %>\r
+ <%= link_to t('home.sign_out.title'), main_app.destroy_demand_user_session_path, :method => :delete %>\r
+ <% else %>\r
+ <%= link_to t('home.sign_in.title'), main_app.new_demand_user_session_path %>\r
+ <% end %>\r
+</div>\r
+<div width="100%" style="background-color: #ddddfa; padding: 5px;">\r
+ <%= link_to t('tab.system.title'), '/system' %>\r
+ <% if admin_signed_in? %>\r
+ <%= link_to t('tab.system.browse'), '/system/browse' %>\r
+ <%= link_to t('tab.system.approve'), '/system/waiting_list' %>\r
+ <%= link_to t('tab.system.port'), '/system/import' %>\r
+ <%= link_to t('tab.system.token'), '/system/auth_token' %>\r
+ <%= t('tab.system.layout') %>:\r
+ <%= link_to t('tab.system.test'), '/system/test_layout' %>\r
+ <%= link_to t('tab.system.production'), '/system/production_layout' %>\r
+ <%= link_to t('home.sign_out.title'), main_app.destroy_admin_session_path, :method => :delete %>\r
+ <% else %>\r
+ <%= link_to t('home.sign_in.title'), main_app.new_admin_session_path %>\r
+ <% end %>\r
+</div>\r
+<%= javascript_tag 'var server_result=' + @server_result.to_json + ';' %>\r
+\r
+</body>\r
+</html>\r
<li id="tabs-5-tab"><a href="#tabs-5">new</a></li>
</ul>
<div id="tabs-1">
- <%= form_for(@panel, :html => {:id => @panel.tag_id('form'), 'data-form-name' => 'panel'}) do |f| %>
+ <%= form_for(@panel, :html => @panel.tag_attributes('form', 'data-form-name' => 'panel')) do |f| %>
<%= render 'system/error_explanation', :obj => @panel %>
<div class="field">
</div>
<% end %>
</div>
- <%# text_field_tag "json", '', :id => 'pettanr-configurations' %>
+ <%= text_field_tag "json", '', :id => 'pettanr-configurations' %>
+ <%# %>
+<div <%= raw @panel.tag_attr('popup') -%> style="display: none;" >
+</div>
--- /dev/null
+<span class="popup" <%= raw elm.tag_attr -%>>
+</span>
<%= render 'standard', :sheet => @sheet, :author => @author %>
+<% if @author %>
+ <% if @sheet.copyable? %>
+ <h2><%= t('sheets.show.copy') -%></h2>
+ <%= form_for(Sheet.new, :html => {:jqform => 'pettanr-sheet-form'}) do |f| %>
+
+ <%= hidden_field_tag "json", @sheet.copy().to_json %>
+ <div>
+ <%= submit_tag t('sheets.show.inspire') -%>
+ </div>
+ <% end %>
+ <% 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 %>
- <h2><%= t('sheets.show.copy') -%></h2>
- <%= form_for(Sheet.new, :html => {:jqform => 'pettanr-sheet-form'}) do |f| %>
-
- <%= hidden_field_tag "json", @sheet.copy().to_json %>
- <div>
- <%= submit_tag t('sheets.show.inspire') -%>
- </div>
- <% end %>
-
<h3><%= t('sheet_panels.append.new_panels') -%></h3>
<table>
<% @new_panels.each do |panel| %>
Mime::Type.register_alias "image/gif", :gif
Mime::Type.register_alias "image/jpeg", :jpeg
Mime::Type.register_alias "application/javascript", :jsonp
+Mime::Type.register_alias "text/html", :prof
ground_color:
panel_id: コマ
code: カラーコード
+ orientation: 方向
+ xy: オフセット
+ wh: サイズ
z: 重なり
t: 話順
caption: 様子
repeat-x: 横方向
repeat-y: 縦方向
no-repeat: なし
+ ground_color:
+ orientation:
+ horizontal: 横方向
+ vertical: 縦方向
speeches:
font_size:
ultra_small: 極小
['select_items.ground_pictures.repeat.repeat-y', 2],
['select_items.ground_pictures.repeat.no-repeat', 3]
]
+ ground_color_orientation_items: [
+ ['select_items.ground_color.orientation.horizontal', 0],
+ ['select_items.ground_color.orientation.vertical', 1]
+ ]
speech_font_size_items: [
['select_items.speeches.font_size.ultra_small', 0.2],
['select_items.speeches.font_size.very_small', 0.4],
--- /dev/null
+class AddOffsetOnGroundColor < ActiveRecord::Migration
+ def up
+ add_column :ground_colors, :orientation, :integer, :null => false, :default => 0
+ add_column :ground_colors, :xy, :integer
+ add_column :ground_colors, :wh, :integer
+ end
+
+ def down
+ remove_column :ground_colors, :orientation
+ remove_column :ground_colors, :xy
+ remove_column :ground_colors, :wh
+ end
+end
puts 'get attributes.json'\r
attr = nil\r
File.open(attrfn, 'r') do |f|\r
- attr = f.read\r
+ attr = JSON.parse(f.read)\r
end\r
json = JSON.parse(open(ls).read)\r
if json['attributes'] and attr\r
json['attributes'] = attr\r
end\r
File.open(lsfn, 'w') do |f|\r
- f.write json.to_json.to_s\r
+ f.write JSON.pretty_generate(json)\r
end\r
else\r
FileUtils.cp ls, lsfn\r
factory :ground_color, :class => GroundColor do |gc|
gc.panel_id 1
gc.code 1
+ gc.orientation 0
gc.z 1
end
context 'オーソドックスなデータのとき' do
it '下限データが通る' do
@gc.code = 0
+ @gc.orientation = 0
+ @gc.xy = 0
+ @gc.wh = 0
@gc.z = 1
@gc.t = 0
@gc.should be_valid
end
it '上限データが通る' do
@gc.code = 99999
+ @gc.orientation = 1
+ @gc.xy = 100
+ @gc.wh = 100
@gc.z = 99999
@gc.t = 99999
@gc.should be_valid
@gc.should_not be_valid
end
end
+ context 'orientationを検証するとき' do
+ it 'nullなら失敗する' do
+ @gc.orientation = nil
+ @gc.should_not be_valid
+ end
+ it '数値でなければ失敗する' do
+ @gc.orientation = 'a'
+ @gc.should_not be_valid
+ end
+ it '負なら失敗する' do
+ @gc.orientation = -1
+ @gc.should_not be_valid
+ end
+ it '2以上なら失敗する' do
+ @gc.orientation = 2
+ @gc.should_not be_valid
+ end
+ end
+ context 'xyを検証するとき' do
+ it 'nullでも通る' do
+ @gc.xy = nil
+ @gc.should be_valid
+ end
+ it '数値でなければ失敗する' do
+ @gc.xy = 'a'
+ @gc.should_not be_valid
+ end
+ it '負なら失敗する' do
+ @gc.xy = -1
+ @gc.should_not be_valid
+ end
+ end
+ context 'whを検証するとき' do
+ it 'nullでも通る' do
+ @gc.wh = nil
+ @gc.should be_valid
+ end
+ it '数値でなければ失敗する' do
+ @gc.wh = 'a'
+ @gc.should_not be_valid
+ end
+ it '負なら失敗する' do
+ @gc.wh = -1
+ @gc.should_not be_valid
+ end
+ end
context 'zを検証するとき' do
it 'nullなら失敗する' do
@gc.z = nil
@gc.z = -1
@gc.should_not be_valid
end
- it '負なら失敗する' do
+ it '0なら失敗する' do
@gc.z = 0
@gc.should_not be_valid
end