gem 'rest-client'
gem 'underscore-rails'
gem 'backbone-rails'
+gem 'backbone-relational-rails'
gem 'kaminari'
gem 'sanitize'
gem 'aws-s3'
//= require textchange
//= require underscore
//= require backbone
+//= require backbone-relational
//= require i18n
//= require ./manifest_base/manifest_base
//= require ./manifest_base/base
//= require_directory ./controllers
//= require_directory ./models
//= require_directory ./views
-//= require_directory ./pettanr
+//= require ./pettanr/pettan_imager
+//= require ./pettanr/operator
//= require main
+++ /dev/null
-class Pettanr.AuthorsController extends Pettanr.AppController\r
- url: '/authors/'\r
- \r
- @singular: () ->\r
- 'Author'\r
- \r
- @plural: () ->\r
- 'Authors'\r
- \r
- defaults: {\r
- id: null,\r
- name: 'no name'\r
- } \r
- \r
- initialize: () ->\r
- if @id\r
- @url = @url + @id\r
-\r
-\r
--- /dev/null
+class Pettanr.AuthorsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.Author.Collection({})\r
+ new Pettanr.FilerRender('author', list_result, 'default', window.operators)\r
+ \r
+\r
+++ /dev/null
-class Pettanr.BalloonsController extends Pettanr.AppController\r
-\r
--- /dev/null
+class Pettanr.BalloonsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.Balloon.Collection({})\r
+ new Pettanr.FilerRender('balloon', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.ComicsController extends Pettanr.AppController\r
- @single: () ->\r
- 'Comic'\r
- \r
- @plural: () ->\r
- 'Comics'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
class Pettanr.ComicStoriesController extends Pettanr.AppController\r
- @single: () ->\r
- 'ComicStory'\r
\r
- @plural: () ->\r
- 'ComicStories'\r
+ index: () ->\r
+ list_result = new Pettanr.ComicStory.Collection({})\r
+ new Pettanr.FilerRender('comic_story', list_result, 'default', window.operators)\r
\r
- defaults: {\r
- id: null\r
- } \r
- \r
- initialize: () ->\r
- \r
-\r
--- /dev/null
+class Pettanr.ComicsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.Comic.Collection({})\r
+ new Pettanr.FilerRender('comic', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.DemandersController extends Pettanr.AppController\r
- \r
- defaults: {\r
- id: null\r
- } \r
- \r
- initialize: () ->\r
- \r
-\r
--- /dev/null
+class Pettanr.DemandersController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.Demander.Collection({})\r
+ new Pettanr.FilerRender('demander', list_result, 'default', window.operators)\r
+ \r
class Pettanr.FoldersController extends Pettanr.AppController\r
+ \r
index: () ->\r
+ list_result = new Pettanr.Folder.Collection({})\r
+ new Pettanr.FilerRender('folder', list_result, 'default', window.operators)\r
\r
root: () ->\r
\r
+++ /dev/null
-class Pettanr.GroundColorsController extends Pettanr.AppController\r
-\r
--- /dev/null
+class Pettanr.GroundColorsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.GroundColor.Collection({})\r
+ new Pettanr.FilerRender('ground_color', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.GroundPicturesController extends Pettanr.AppController\r
- @single: () ->\r
- 'GroundPicture'\r
- \r
- @plural: () ->\r
- 'GroundPictures'\r
- \r
- @colum_structures: ->\r
- {}\r
- \r
- defaults: {\r
- x: 11\r
- } \r
- \r
-\r
--- /dev/null
+class Pettanr.GroundPicturesController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.GroundPicture.Collection({})\r
+ new Pettanr.FilerRender('ground_picture', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.LicensesController extends Pettanr.AppController\r
- @single: () ->\r
- 'License'\r
- \r
- @plural: () ->\r
- 'Licenses'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
+++ /dev/null
-class Pettanr.LicenseGroupsController extends Pettanr.AppController\r
- @single: () ->\r
- 'LicenseGroup'\r
- \r
- @plural: () ->\r
- 'LicenseGroups'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
--- /dev/null
+class Pettanr.LicenseGroupsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.LicenseGroup.Collection({})\r
+ new Pettanr.FilerRender('license_group', list_result, 'default', window.operators)\r
+ \r
--- /dev/null
+class Pettanr.LicensesController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.License.Collection({})\r
+ new Pettanr.FilerRender('license', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.OriginalPicturesController extends Pettanr.AppController\r
- @single: () ->\r
- 'OriginalPicture'\r
- \r
- @plural: () ->\r
- 'OriginalPictures'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
+++ /dev/null
-class Pettanr.OriginalPictureLicensesController extends Pettanr.AppController\r
- @single: () ->\r
- 'OriginalPictureLicense'\r
- \r
- @plural: () ->\r
- 'OriginalPictureLicenses'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
+++ /dev/null
-class Pettanr.OriginalPictureLicenseGroupsController extends Pettanr.AppController\r
- @single: () ->\r
- 'OriginalPictureLicenseGroup'\r
- \r
- @plural: () ->\r
- 'OriginalPictureLicenseGroups'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
--- /dev/null
+class Pettanr.OriginalPictureLicenseGroupsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.OriginalPictureLicenseGroup.Collection({})\r
+ new Pettanr.FilerRender('original_picture_license_group', list_result, 'default', window.operators)\r
+ \r
+\r
--- /dev/null
+class Pettanr.OriginalPictureLicensesController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.OriginalPictureLicense.Collection({})\r
+ new Pettanr.FilerRender('original_picture_license', list_result, 'default', window.operators)\r
+ \r
--- /dev/null
+class Pettanr.OriginalPicturesController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.OriginalPicture.Collection({})\r
+ new Pettanr.FilerRender('original_picture', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.PanelsController extends Pettanr.AppController\r
- @single: () ->\r
- 'Panel'\r
- \r
- @plural: () ->\r
- 'Panels'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
+++ /dev/null
-class Pettanr.PanelPicturesController extends Pettanr.AppController\r
- @single: () ->\r
- 'PanelPicture'\r
- \r
- @plural: () ->\r
- 'PanelPictures'\r
- \r
- @colum_structures: ->\r
- {}\r
- \r
- defaults: {\r
- x: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to this world")\r
- \r
-\r
--- /dev/null
+class Pettanr.PanelPicturesController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.PanelPicture.Collection({})\r
+ new Pettanr.FilerRender('panel_picture', list_result, 'default', window.operators)\r
+ \r
--- /dev/null
+class Pettanr.PanelsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.Panel.Collection({})\r
+ new Pettanr.FilerRender('panel', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.PicturesController extends Pettanr.AppController\r
- @single: () ->\r
- 'Picture'\r
- \r
- @plural: () ->\r
- 'Pictures'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
-\r
--- /dev/null
+class Pettanr.PicturesController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.Picture.Collection({})\r
+ new Pettanr.FilerRender('picture', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.ResourcePicturesController extends Pettanr.AppController\r
- @single: () ->\r
- 'ResourcePicture'\r
- \r
- @plural: () ->\r
- 'ResourcePictures'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
--- /dev/null
+class Pettanr.ResourcePicturesController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.ResourcePicture.Collection({})\r
+ new Pettanr.FilerRender('resource_picture', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.ScrollPanelsController extends Pettanr.AppController\r
- @single: () ->\r
- 'ScrollPanel'\r
- \r
- @plural: () ->\r
- 'ScrollPanels'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
--- /dev/null
+class Pettanr.ScrollPanelsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.ScrollPanel.Collection({})\r
+ new Pettanr.FilerRender('scroll_panel', list_result, 'default', window.operators)\r
+ \r
index: () ->\r
list_result = new Pettanr.Scroll.Collection({})\r
new Pettanr.FilerRender('scroll', list_result, 'default', window.operators)\r
-\r
- root: () ->\r
\r
show_html_format: (format) -> \r
\r
item = new Pettanr.Scroll({id: id})\r
_this = this\r
item.fetch({}).done () ->\r
+ alert(item)\r
\r
count: () ->\r
\r
- folders_new: () ->\r
+ new: () ->\r
\r
edit: () ->\r
\r
+++ /dev/null
-class Pettanr.SheetsController extends Pettanr.AppController\r
- @single: () ->\r
- 'Sheet'\r
- \r
- @plural: () ->\r
- 'Sheets'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
+++ /dev/null
-class Pettanr.SheetPanelsController extends Pettanr.AppController\r
- @single: () ->\r
- 'SheetPanel'\r
- \r
- @plural: () ->\r
- 'SheetPanels'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
--- /dev/null
+class Pettanr.SheetPanelsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.SheetPanel.Collection({})\r
+ new Pettanr.FilerRender('sheet_panel', list_result, 'default', window.operators)\r
+ \r
--- /dev/null
+class Pettanr.SheetsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.Sheet.Collection({})\r
+ new Pettanr.FilerRender('sheet', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.SpeechesController extends Pettanr.AppController\r
- @single: () ->\r
- 'Speech'\r
- \r
- @plural: () ->\r
- 'Speeches'\r
- \r
- @colum_structures: ->\r
- {}\r
- \r
- defaults: {\r
- x: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to this world")\r
- \r
-\r
+++ /dev/null
-class Pettanr.SpeechBalloonsController extends Pettanr.AppController\r
- @single: () ->\r
- 'SpeechBalloon'\r
- \r
- @plural: () ->\r
- 'SpeechBalloons'\r
- \r
- @colum_structures: ->\r
- {}\r
- \r
- defaults: {\r
- x: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to this world")\r
- \r
-\r
+++ /dev/null
-class Pettanr.SpeechBalloonTemplatesController extends Pettanr.AppController\r
-\r
--- /dev/null
+class Pettanr.SpeechBalloonTemplatesController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.SpeechBalloonTemplate.Collection({})\r
+ new Pettanr.FilerRender('speech_balloon_template', list_result, 'default', window.operators)\r
+ \r
--- /dev/null
+class Pettanr.SpeechBalloonsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.SpeechBalloon.Collection({})\r
+ new Pettanr.FilerRender('speech_balloon', list_result, 'default', window.operators)\r
+ \r
--- /dev/null
+class Pettanr.SpeechesController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.Speech.Collection({})\r
+ new Pettanr.FilerRender('speech', list_result, 'default', window.operators)\r
+ \r
--- /dev/null
+class Pettanr.StoriesController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.Story.Collection({})\r
+ new Pettanr.FilerRender('story', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.StoriesController extends Pettanr.AppController\r
- @single: () ->\r
- 'Story'\r
- \r
- @plural: () ->\r
- 'Stories'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
+++ /dev/null
-class Pettanr.StorySheetsController extends Pettanr.AppController\r
- @single: () ->\r
- 'StorySheet'\r
- \r
- @plural: () ->\r
- 'StorySheets'\r
- \r
- defaults: {\r
- id: 11\r
- } \r
- \r
- initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
-\r
--- /dev/null
+class Pettanr.StorySheetsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.StorySheet.Collection({})\r
+ new Pettanr.FilerRender('story_sheet', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.SystemPicturesController extends Pettanr.AppController\r
--- /dev/null
+class Pettanr.SystemPicturesController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.SystemPicture.Collection({})\r
+ new Pettanr.FilerRender('system_picture', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.UsersController extends Pettanr.AppController\r
- \r
- url: '/users/'\r
- \r
- defaults: {\r
- id: null\r
- } \r
- \r
- author: () ->\r
- \r
- artist: () ->\r
- \r
- initialize: () ->\r
- if @id\r
- @url = @url + @id\r
- \r
--- /dev/null
+class Pettanr.UsersController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.User.Collection({})\r
+ new Pettanr.FilerRender('user', list_result, 'default', window.operators)\r
+ \r
+++ /dev/null
-class Pettanr.WritingFormatsController extends Pettanr.AppController\r
-\r
--- /dev/null
+class Pettanr.WritingFormatsController extends Pettanr.AppController\r
+ \r
+ index: () ->\r
+ list_result = new Pettanr.WritingFormat.Collection({})\r
+ new Pettanr.FilerRender('writing_format', list_result, 'default', window.operators)\r
+ \r
"javascript:void(0)"\r
\r
url: () ->\r
- @item.get(@my_manifest.column_name())\r
+ @item.get(@my_manifest.column_name)\r
\r
this\r
\r
method_name: () ->\r
- @my_manifest.method_name()\r
+ @my_manifest.method_name\r
\r
url: () ->\r
- if @item.methods(true).is_include(@method_name())\r
- @item[@method_name()]()\r
+ if @item[@method_name()]\r
+ @item[@method_name()]().src\r
else\r
'/images/error.png'\r
\r
"javascript:void(0)"\r
\r
url: () ->\r
- @item.get(@my_manifest.column_name())\r
+ @item.get(@my_manifest.column_name)\r
\r
true\r
\r
@item_name_to_model: (item_name) ->\r
- Pettanr[Pettanr.capitalize(item_name)]\r
+ Pettanr[Pettanr.camelize(item_name)]\r
\r
@singularize: (name) ->\r
name.replace(/es$/, '').replace(/s$/, '')\r
} \r
\r
initialize: () ->\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.Admin.Collection extends Backbone.Collection\r
+ model: Pettanr.Admin\r
+ url: '/admins'\r
initialize: () ->\r
if @id\r
@url = @url + @id\r
-\r
-\r
+ \r
+class Pettanr.Author.Collection extends Backbone.Collection\r
+ model: Pettanr.Author\r
+ url: '/authors'\r
class Pettanr.Balloon extends Peta.Element\r
+ @singular: () ->\r
+ 'Balloon'\r
+ \r
+ @plural: () ->\r
+ 'Balloons'\r
+ \r
+ defaults: {\r
+ id: null,\r
+ x: 0,\r
+ y: 0,\r
+ width: 100,\r
+ height: 100,\r
+ r: 0\r
+ } \r
+ \r
+ url: () ->\r
+ '/system_pictures/' + @system_picture().filename()\r
+ \r
+ symbol_option: () ->\r
+ @speech_balloon().speech_balloon_template().symbol_option()\r
+ \r
+ style: () ->\r
+ {\r
+ width: Pettanr.to_s(@get('width')) + 'px', \r
+ height: Pettanr.to_s(@get('height')) + 'px',\r
+ top: Pettanr.to_s(@get('y')) + 'px',\r
+ left: Pettanr.to_s(@get('x')) + 'px'\r
+ }\r
+ \r
+ initialize: () ->\r
+ if @id\r
+ @url = @url + @id\r
+ \r
+class Pettanr.Balloon.Collection extends Backbone.Collection\r
+ model: Pettanr.Balloon\r
+ url: '/balloons'\r
\r
class Pettanr.Comic extends Peta.Binder\r
- @single: () ->\r
+ @singular: () ->\r
'Comic'\r
\r
@plural: () ->\r
'Comics'\r
\r
defaults: {\r
- id: 11\r
+ id: null,\r
+ visible: 0,\r
+ author_id: null\r
} \r
\r
+ is_visible: (operators) ->\r
+ switch super(operators)\r
+ when null\r
+ return true\r
+ when false\r
+ return false\r
+ else\r
+ @get('visible') > 0\r
+ \r
+ symbol_filename: () ->\r
+ \r
initialize: () ->\r
- confirm("Welcome to Panel")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.Comic.Collection extends Backbone.Collection\r
+ model: Pettanr.Comic\r
+ url: '/comics'\r
--- /dev/null
+class Pettanr.ComicStory extends Peta.Leaf\r
+ @singular: () ->\r
+ 'ComicStory'\r
+ \r
+ @plural: () ->\r
+ 'ComicStories'\r
+ \r
+ defaults: {\r
+ id: null,\r
+ comic_id: null,\r
+ story_id: null,\r
+ t: null\r
+ } \r
+ \r
+ disp_t: () ->\r
+ @get('t') + 1\r
+ \r
+ disp_t_by_text: () ->\r
+ I18n.t('comic_stories.show.t', {t: @disp_t()})\r
+ \r
+ title: () ->\r
+ @disp_t_by_text() + ':' + @story().get('title')\r
+ \r
+ initialize: () ->\r
+ if @id\r
+ @url = @url + @id\r
+ \r
+class Pettanr.ComicStory.Collection extends Backbone.Collection\r
+ model: Pettanr.ComicStory\r
+ url: '/comic_stories'\r
class Pettanr.GroundColor extends Peta.Element\r
-\r
+ @singular: () ->\r
+ 'GroundColor'\r
+ \r
+ @plural: () ->\r
+ 'GroundColors'\r
+ \r
+ defaults: {\r
+ id: null,\r
+ code: 0,\r
+ } \r
+ \r
+ @has_picture: () ->\r
+ false\r
+ \r
+ div_offset: () ->\r
+ if @get('xy')\r
+ @get('xy')\r
+ else\r
+ 0\r
+ \r
+ div_size: () ->\r
+ if @get('wh')\r
+ @get('wh')\r
+ else\r
+ 100 - @div_offset()\r
+ \r
+ div_x: () ->\r
+ if @get('orientation') == 0\r
+ 0\r
+ else\r
+ @div_offset()\r
+ \r
+ div_y: () ->\r
+ if @get('orientation') == 0\r
+ @div_offset()\r
+ else\r
+ 0\r
+ \r
+ div_width: () ->\r
+ if @get('orientation') == 0\r
+ 100\r
+ else\r
+ @div_size()\r
+ \r
+ div_height: () ->\r
+ if @get('orientation') == 0\r
+ @div_size()\r
+ else\r
+ 100\r
+ \r
+ style: (spot = null, opacity = 20) ->\r
+ r = {\r
+ position: 'absolute', \r
+ 'z-index': @get('z'), \r
+ top: Pettanr.to_s(@div_y()) + '%', \r
+ left: Pettanr.to_s(@div_x()) + '%', \r
+ width: Pettanr.to_s(@div_width()) + '%', \r
+ height: Pettanr.to_s(@div_height()) + '%', \r
+ 'background-color': '#' + ('000000' + Pettanr.to_s(@get('code'))).slice(-6)\r
+ }\r
+ @merge_opacity(r, opacity) if spot and spot != this\r
+ r\r
+ \r
+ initialize: () ->\r
+ if @id\r
+ @url = @url + @id\r
+ \r
+class Pettanr.GroundColor.Collection extends Backbone.Collection\r
+ model: Pettanr.GroundColor\r
+ url: '/ground_colors'\r
class Pettanr.GroundPicture extends Peta.Element\r
- @single: () ->\r
+ @singular: () ->\r
'GroundPicture'\r
\r
@plural: () ->\r
'GroundPictures'\r
\r
- @colum_structures: ->\r
- {}\r
- \r
defaults: {\r
- x: 11\r
+ id: null,\r
+ x: 0,\r
+ y: 0,\r
+ repeat: 0\r
} \r
\r
-\r
+ @repeat_texts: () -> \r
+ ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']\r
+ \r
+ picture: () ->\r
+ @get('picture')\r
+ \r
+ has_picture: () ->\r
+ true\r
+ \r
+ style: (spot = null, opacity = 20) ->\r
+ r = {\r
+ position: 'absolute', \r
+ top: '0px', \r
+ left: '0px',\r
+ 'z-index': @get('z'), \r
+ 'background-image': 'url(' + @picture().r_url() + ')', \r
+ 'background-repeat': @repeat_text(), \r
+ 'background-position': Pettanr.to_s(@get('x')) + 'px ' + Pettanr.to_s(@get('y')) + 'px'\r
+ }\r
+ @merge_opacity(r, opacity) if spot and spot != this\r
+ r\r
+ \r
+ tmb_opt_img_tag: () ->\r
+ wh = Pettanr.Imager.thumbnail_size(@picture().get('width'), @picture().get('height'))\r
+ {src: @picture().r_url(), width: wh[0], height: wh[1], alt: @get('caption')}\r
+ \r
+ symbol_option: () ->\r
+ @tmb_opt_img_tag()\r
+ \r
+ repeat_text: () ->\r
+ Pettanr.GroundPicture.repeat_texts()[@get('repeat')]\r
+ \r
+ initialize: () ->\r
+ if @id\r
+ @url = @url + @id\r
+ \r
+class Pettanr.GroundPicture.Collection extends Backbone.Collection\r
+ model: Pettanr.GroundPicture\r
+ url: '/ground_pictures'\r
class Pettanr.License extends Peta.SystemResource\r
- @single: () ->\r
+ @singular: () ->\r
'License'\r
\r
@plural: () ->\r
'Licenses'\r
\r
defaults: {\r
- id: 11\r
+ id: null\r
} \r
\r
+ license_group: () ->\r
+ r = new Pettanr.LicenseGroup({id: @get('license_group_id')})\r
+ r.fetch({}).done () ->\r
+ r\r
+ \r
+ caption_with_group: () ->\r
+ @license_group().get('caption') + '/' + @get('caption')\r
+ \r
initialize: () ->\r
- confirm("Welcome to Panel")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.License.Collection extends Backbone.Collection\r
+ model: Pettanr.License\r
+ url: '/licenses'\r
class Pettanr.LicenseGroup extends Peta.Template\r
- @single: () ->\r
+ @singular: () ->\r
'LicenseGroup'\r
\r
@plural: () ->\r
'LicenseGroups'\r
\r
defaults: {\r
- id: 11\r
+ id: null\r
} \r
\r
initialize: () ->\r
- confirm("Welcome to Panel")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.LicenseGroup.Collection extends Backbone.Collection\r
+ model: Pettanr.LicenseGroup\r
+ url: '/license_groups'\r
class Pettanr.OriginalPicture extends Peta.Content\r
- @single: () ->\r
+ @singular: () ->\r
'OriginalPicture'\r
\r
@plural: () ->\r
'OriginalPictures'\r
\r
defaults: {\r
- id: 11\r
+ id: null,\r
+ artist_id: nil\r
} \r
\r
+ is_visible: (operators) ->\r
+ @is_own(operators)\r
+ \r
+ filename: () ->\r
+ @get('id') + '.' + @get('ext')\r
+ \r
+ mime_type: () ->\r
+ 'image/' + @get('ext')\r
+ \r
+ r_url: () ->\r
+ '/original_pictures/' + @filename()\r
+ \r
+ opt_img_tag: () ->\r
+ {src: @r_url(), width: @get('width'), height: @get('height')}\r
+ \r
+ tmb_opt_img_tag: () ->\r
+ wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))\r
+ {src: @r_url(), width: wh[0], height: wh[1]}\r
+ \r
+ symbol_option: () ->\r
+ @tmb_opt_img_tag()\r
+ \r
+ revision: () ->\r
+ head = @history()[0]\r
+ if head\r
+ head.revision()\r
+ else\r
+ 'unpublished'\r
+ \r
+ is_unpublished: () ->\r
+ @get('published_at') == null and @get('stopped_at') == null\r
+ \r
+ is_stopped: () ->\r
+ @get('stopped_at') != null\r
+ \r
+ is_unlicensed: () ->\r
+ dt = @get('published_at') || @get('stopped_at')\r
+ return false if not dt\r
+ @get('uploaded_at') > dt\r
+ \r
+ is_published: () ->\r
+ @get('published_at') != null\r
+ \r
initialize: () ->\r
- confirm("Welcome to Panel")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.OriginalPicture.Collection extends Backbone.Collection\r
+ model: Pettanr.OriginalPicture\r
+ url: '/original_pictures'\r
class Pettanr.OriginalPictureLicense extends Peta.Item\r
- @single: () ->\r
+ @singular: () ->\r
'OriginalPictureLicense'\r
\r
@plural: () ->\r
'OriginalPictureLicenses'\r
\r
defaults: {\r
- id: 11\r
+ id: null\r
} \r
\r
initialize: () ->\r
- confirm("Welcome to Panel")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.OriginalPictureLicense.Collection extends Backbone.Collection\r
+ model: Pettanr.OriginalPictureLicense\r
+ url: '/original_picture_licenses'\r
class Pettanr.OriginalPictureLicenseGroup extends Peta.Item\r
- @single: () ->\r
+ @singular: () ->\r
'OriginalPictureLicenseGroup'\r
\r
@plural: () ->\r
'OriginalPictureLicenseGroups'\r
\r
defaults: {\r
- id: 11\r
+ id: null\r
} \r
\r
initialize: () ->\r
- confirm("Welcome to Panel")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.OriginalPictureLicenseGroup.Collection extends Backbone.Collection\r
+ model: Pettanr.OriginalPictureLicenseGroup\r
+ url: '/original_picture_license_groups'\r
'Panels'\r
\r
defaults: {\r
- id: 11\r
+ id: null,\r
+ border: 2,\r
+ publish: 0\r
} \r
\r
initialize: () ->\r
- confirm("Welcome to Panel")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.Panel.Collection extends Backbone.Collection\r
+ model: Pettanr.Panel\r
+ url: '/panels'\r
class Pettanr.PanelPicture extends Peta.Element\r
- @single: () ->\r
+ @singular: () ->\r
'PanelPicture'\r
\r
@plural: () ->\r
'PanelPictures'\r
\r
- @colum_structures: ->\r
- {}\r
- \r
defaults: {\r
- x: 11\r
+ id: null\r
} \r
\r
+ @has_picture: () ->\r
+ true\r
+ \r
+ flip: () ->\r
+ v = if @get('height') > 0\r
+ ''\r
+ else\r
+ 'v'\r
+ h = if @get('width') > 0\r
+ ''\r
+ else\r
+ 'h'\r
+ res = v + h\r
+ res = res # format of /1.png?subdir=v\r
+ # res += '/' unless res.empty? # format of /v/1.png\r
+ res\r
+ \r
+ filename: () ->\r
+ @picture().filename() + '?subdir=' + @flip()\r
+ \r
+ r_url: () ->\r
+ '/pictures/' + @filename()\r
+ \r
+ opt_div_style: () ->\r
+ "top:#{@get('y')}px; left:#{@get('x')}px; z-index:#{@get('z')}; position: absolute;"\r
+ \r
+ opt_img_tag: (spot = null, opacity = 20) ->\r
+ o = if spot and spot != this\r
+ "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});"\r
+ else\r
+ ''\r
+ @tag_attributes('img', {\r
+ class: "panel-picture", \r
+ vPicture: @get('id'), \r
+ src: @r_url(), \r
+ width: Math.abs(@get('width')), \r
+ height: Math.abs(@get('height')), \r
+ picture_id: @get('picture_id'), \r
+ ext: @picture.ext, \r
+ alt: @get('caption'), \r
+ style: "#{o}"\r
+ })\r
+ \r
+ tmb_opt_img_tag: () ->\r
+ wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))\r
+ {src: @r_url(), width: Math.abs(wh[0]), height: Math.abs(wh[1]), alt: @get('caption')}\r
+ \r
+ symbol_option: () ->\r
+ @picture().symbol_option()\r
+ \r
initialize: () ->\r
- confirm("Welcome to this world")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.PanelPicture.Collection extends Backbone.Collection\r
+ model: Pettanr.PanelPicture\r
+ url: '/panel_pictures'\r
class Pettanr.Picture extends Peta.Content\r
- @single: () ->\r
+ @singular: () ->\r
'Picture'\r
\r
@plural: () ->\r
'Pictures'\r
\r
defaults: {\r
- id: 11\r
+ id: null\r
} \r
\r
+ is_visible: (operators) ->\r
+ return true\r
+ \r
+ filename: () ->\r
+ @get('id') + '.' + @get('ext')\r
+ \r
+ gifname: () ->\r
+ @get('id') + '.gif'\r
+ \r
+ mime_type: () ->\r
+ 'image/' + @get('ext')\r
+ \r
+ r_url: () ->\r
+ '/pictures/' + @filename()\r
+ \r
+ opt_img_tag: () ->\r
+ {src: @r_url(), width: @get('width'), height: @get('height')}\r
+ \r
+ tmb_opt_img_tag: () ->\r
+ wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))\r
+ {src: @r_url(), width: wh[0], height: wh[1]}\r
+ \r
+ tail_opt_img_tag: (img) ->\r
+ {src: img, width: @get('width'), height: @get('height')}\r
+ \r
+ tail_tmb_opt_img_tag: (img) ->\r
+ wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))\r
+ {src: img, width: wh[0], height: wh[1]}\r
+ \r
+ alt_name: () ->\r
+ lgn = Pettanr.to_s(@license().license_group().get('caption'))\r
+ ln = Pettanr.to_s(@license().get('caption'))\r
+ lgn + '[' + ln + ']'\r
+ \r
+ symbol_option: () ->\r
+ @tmb_opt_img_tag()\r
+ \r
+ is_enable: () ->\r
+ if @head().resource_picture()\r
+ true\r
+ else\r
+ false\r
+ \r
+ @head: (opid) ->\r
+ #Picture.find( conditions => ['original_picture_id = ?', opid], :order => 'pictures.revision desc')\r
+ \r
+ head: () ->\r
+ Picture.head(@get('original_picture_id'))\r
+ \r
+ is_head: () ->\r
+ #this == @head()\r
+ \r
+ subdirs: () ->\r
+ if @license_extend().reverse < 0\r
+ ['']\r
+ else\r
+ ['', 'v', 'h', 'vh']\r
+ \r
+ is_showable: (operators = null) ->\r
+ return false if not @original_picture()\r
+ return true if @is_own(operators)\r
+ #@is_enable() and @is_head()\r
+ \r
initialize: () ->\r
- confirm("Welcome to Panel")\r
-\r
+ if @id\r
+ @url = @url + @id\r
+ \r
+class Pettanr.Picture.Collection extends Backbone.Collection\r
+ model: Pettanr.Picture\r
+ url: '/pictures'\r
class Pettanr.ResourcePicture extends Peta.Content\r
- @single: () ->\r
+ @singular: () ->\r
'ResourcePicture'\r
\r
@plural: () ->\r
'ResourcePictures'\r
\r
defaults: {\r
- id: 11\r
+ id: null\r
} \r
\r
+ is_visible: (operators) ->\r
+ @is_user_visible(operators)\r
+ \r
+ filename: () ->\r
+ @get('id') + '.' + @get('ext')\r
+ \r
+ gifname: () ->\r
+ @get('id') + '.gif'\r
+ \r
+ mime_type: () ->\r
+ 'image/' + @get('ext')\r
+ \r
+ r_url: (subdir = null) ->\r
+ opt = if Pettanr.to_s(@subdir).empty\r
+ ''\r
+ else\r
+ '?subdir=' + Pettanr.to_s(subdir)\r
+ '/resource_pictures/' + @filename() + opt\r
+ \r
+ tmb_opt_img_tag: () ->\r
+ wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))\r
+ {src: @r_url(), width: wh[0], height: wh[1]}\r
+ \r
+ opt_img_tag: () ->\r
+ {src: @url('full'), width: @get('width'), height: @get('height')}\r
+ \r
+ alt_name: () ->\r
+ lgn = Pettanr.to_s(@license().license_group().get('caption'))\r
+ ln = Pettanr.to_s(@license().get('caption'))\r
+ lgn + '[' + ln + ']'\r
+ \r
+ symbol_option: () ->\r
+ @tmb_opt_img_tag()\r
+ \r
initialize: () ->\r
- confirm("Welcome to Panel")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.ResourcePicture.Collection extends Backbone.Collection\r
+ model: Pettanr.ResourcePicture\r
+ url: '/resource_pictures'\r
class Pettanr.ScrollPanel extends Peta.Leaf\r
url: ''\r
\r
- @single: () ->\r
+ @singular: () ->\r
'ScrollPanel'\r
\r
@plural: () ->\r
\r
defaults: {\r
id: null,\r
+ scroll_id: null,\r
+ panel_id: null,\r
+ t: null\r
} \r
\r
initialize: () ->\r
class Pettanr.Sheet extends Peta.Root\r
- @single: () ->\r
+ @singular: () ->\r
'Sheet'\r
\r
@plural: () ->\r
'Sheets'\r
\r
defaults: {\r
- id: 11\r
+ id: null,\r
+ visible: 0,\r
+ author_id: null\r
} \r
\r
+ is_visible: (operators) ->\r
+ switch super(operators)\r
+ when null\r
+ return true\r
+ when false\r
+ return false\r
+ else\r
+ @get('visible') > 0\r
+ \r
initialize: () ->\r
- confirm("Welcome to Panel")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.Sheet.Collection extends Backbone.Collection\r
+ model: Pettanr.Sheet\r
+ url: '/sheets'\r
class Pettanr.SheetPanel extends Peta.Leaf\r
- @single: () ->\r
+ @singular: () ->\r
'SheetPanel'\r
\r
@plural: () ->\r
'SheetPanels'\r
\r
defaults: {\r
- id: 11\r
+ id: null,\r
+ x: 15,\r
+ y: 15,\r
+ sheet_id: null,\r
+ panel_id: null,\r
+ z: 1,\r
+ t: null\r
} \r
\r
initialize: () ->\r
- confirm("Welcome to Panel")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.SheetPanel.Collection extends Backbone.Collection\r
+ model: Pettanr.SheetPanel\r
+ url: '/sheet_panels'\r
-class Pettanr.SpeechBalloon extends Peta.Element\r
- @single: () ->\r
+class Pettanr.Speech extends Peta.Element\r
+ @singular: () ->\r
'Speech'\r
\r
@plural: () ->\r
'Speeches'\r
\r
- @colum_structures: ->\r
- {}\r
- \r
defaults: {\r
- x: 11\r
+ id: null,\r
+ x: 0,\r
+ y: 0,\r
+ width: 100,\r
+ height: 100\r
} \r
\r
+ @text_align_texts: () -> \r
+ ['left', 'left', 'right', 'center']\r
+ \r
+ symbol_option: () ->\r
+ @speech_balloon().speech_balloon_template().symbol_option()\r
+ \r
+ outer_style: () ->\r
+ {\r
+ top: @get('y'), left: @get('x'), \r
+ width: @get('width'), height: @get('height')\r
+ }\r
+ \r
+ inner_style: () ->\r
+ {\r
+ 'font-size': Pettanr.to_s(@get('font_size')) + 'em',\r
+ 'text-align': @text_align_text(), \r
+ color: '#' + ('000000' + Pettanr.to_s(@get('fore_color'))).slice(-6)\r
+ }\r
+ \r
+ text_align_text: () ->\r
+ Pettanr.Speech.text_align_texts()[@get('text_align')]\r
+ \r
initialize: () ->\r
- confirm("Welcome to this world")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.Speech.Collection extends Backbone.Collection\r
+ model: Pettanr.Speech\r
+ url: '/Speeches'\r
class Pettanr.SpeechBalloon extends Peta.Element\r
- @single: () ->\r
+ @singular: () ->\r
'SpeechBalloon'\r
\r
@plural: () ->\r
'SpeechBalloons'\r
\r
- @colum_structures: ->\r
- {}\r
- \r
defaults: {\r
- x: 11\r
+ id: null,\r
+ z: null,\r
+ t: null\r
} \r
\r
+ @has_picture: () ->\r
+ false\r
+ \r
+ @symbol_option: () ->\r
+ @speech_balloon_template.symbol_option\r
+ \r
initialize: () ->\r
- confirm("Welcome to this world")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.SpeechBalloon.Collection extends Backbone.Collection\r
+ model: Pettanr.SpeechBalloon\r
+ url: '/speech_balloons'\r
class Pettanr.SpeechBalloonTemplate extends Peta.Template\r
-\r
+ relations: [{\r
+ type: Backbone.HasMany,\r
+ key: 'speech_balloons',\r
+ relatedModel: 'SpeechBalloon',\r
+ collectionType: 'SpeechBalloonCollection',\r
+ reverseRelation: {\r
+ key: 'livesIn',\r
+ includeInJSON: 'id'\r
+ }\r
+ }]\r
+ \r
+ @singular: () ->\r
+ 'SpeechBalloonTemplate'\r
+ \r
+ @plural: () ->\r
+ 'SpeechBalloonTemplates'\r
+ \r
+ defaults: {\r
+ id: null\r
+ } \r
+ \r
+ get_system_picture: () ->\r
+ new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
+ \r
+ symbol_option: () ->\r
+ _this = this\r
+ r = @get_system_picture()\r
+ r.fetch({}).done () ->\r
+ _this.system_picture = r\r
+ _this.system_picture.tmb_opt_img_tag()\r
+ \r
+ initialize: () ->\r
+ if @id\r
+ @url = @url + @id\r
+ @system_picture = null\r
+ \r
+class Pettanr.SpeechBalloonTemplate.Collection extends Backbone.Collection\r
+ model: Pettanr.SpeechBalloonTemplate\r
+ url: '/speech_balloon_templates'\r
class Pettanr.Story extends Peta.Binder\r
- @single: () ->\r
+ @singular: () ->\r
'Story'\r
\r
@plural: () ->\r
'Stories'\r
\r
defaults: {\r
- id: 11\r
+ id: null,\r
+ visible: 0,\r
+ author_id: null\r
} \r
\r
+ is_visible: (operators) ->\r
+ switch super(operators)\r
+ when null\r
+ return true\r
+ when false\r
+ return false\r
+ else\r
+ @get('visible') > 0\r
+ \r
initialize: () ->\r
- confirm("Welcome to Panel")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.Story.Collection extends Backbone.Collection\r
+ model: Pettanr.Story\r
+ url: '/stories'\r
class Pettanr.StorySheet extends Peta.Leaf\r
- @single: () ->\r
+ @singular: () ->\r
'StorySheet'\r
\r
@plural: () ->\r
'StorySheets'\r
\r
defaults: {\r
- id: 11\r
+ id: null,\r
+ story_id: null,\r
+ sheet_id: null,\r
+ t: null\r
} \r
\r
initialize: () ->\r
- confirm("Welcome to Panel")\r
+ if @id\r
+ @url = @url + @id\r
\r
-\r
+class Pettanr.StorySheet.Collection extends Backbone.Collection\r
+ model: Pettanr.StorySheet\r
+ url: '/story_sheets'\r
class Pettanr.SystemPicture extends Peta.SystemResource\r
+ url: '/system_pictures/'\r
+ @singular: () ->\r
+ 'SystemPicture'\r
+ \r
+ @plural: () ->\r
+ 'SystemPictures'\r
+ \r
+ defaults: {\r
+ id: null\r
+ } \r
+ \r
+ filename: () ->\r
+ @get('id') + '.' + @get('ext')\r
+ \r
+ mime_type: () ->\r
+ 'image/' + @get('ext')\r
+ \r
+ r_url: () ->\r
+ '/system_pictures/' + @filename()\r
+ \r
+ opt_img_tag: () ->\r
+ {src: @r_url(), width: @get('width'), height: @get('height')}\r
+ \r
+ tmb_opt_img_tag: () ->\r
+ wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))\r
+ {src: @r_url(), width: wh[0], height: wh[1]}\r
+ \r
+ symbol_option: () ->\r
+ @tmb_opt_img_tag()\r
+ \r
+ initialize: () ->\r
+ if @id\r
+ @url = @url + @id\r
+ \r
+class Pettanr.SystemPicture.Collection extends Backbone.Collection\r
+ model: Pettanr.SystemPicture\r
+ url: '/system_pictures'\r
if @id\r
@url = @url + @id\r
\r
+class Pettanr.User.Collection extends Backbone.Collection\r
+ model: Pettanr.User\r
+ url: '/users'\r
class Pettanr.WritingFormat extends Peta.Template\r
+ @singular: () ->\r
+ 'WritingFormat'\r
+ \r
+ @plural: () ->\r
+ 'WritingFormats'\r
+ \r
+ defaults: {\r
+ id: null\r
+ } \r
+ \r
+ initialize: () ->\r
+ if @id\r
+ @url = @url + @id\r
+ \r
+class Pettanr.WritingFormat.Collection extends Backbone.Collection\r
+ model: Pettanr.WritingFormat\r
+ url: '/writing_formats'\r
\r
--- /dev/null
+class Pettanr.Imager
+ @thumbnail_size: (w, h) ->
+ lw = Manifest.manifest().magic_numbers['thumbnail_width']
+ lh = Manifest.manifest().magic_numbers['thumbnail_height']
+ Pettanr.Imager.fix_size_both lw, lh, w, h
+
+ @fix_size_both: (limw, limh, w, h)->
+ wr = if w > limw
+ limw*100/w
+ else
+ 100
+ hr = if h > limh
+ limh*100/h
+ else
+ 100
+ r = if wr < hr
+ [w*wr/100, h*wr/100]
+ else
+ [w*hr/100, h*hr/100]
+ r
+
\r
show_html_format: (format) -> \r
\r
- folders_show: (id) ->\r
- console.log(controller_name)\r
- \r
count: () ->\r
\r
new: () ->\r
_this = this\r
_.each _.flatten(names), (status) ->\r
_status = status\r
- f = switch status.action_manifest.type\r
+ switch status.action_manifest.type\r
when 'list'\r
_this[status.event_name] = () ->\r
_status.controller[_status.action_name]()\r
when 'show'\r
_this[status.event_name] = (id) ->\r
_status.controller[_status.action_name](id)\r
- r = _status.controller_name + '/:id/' + _status.action_name\r
+ r = '^' + _status.controller_name + '\/([0-9]+)\/' + _status.action_name + '$'\r
_this.route(r, _status.event_name)\r
if _status.action_name == 'show'\r
- r = _status.controller_name + '/:id'\r
- _this.route(r, _status.event_name)\r
+ r = '^' + _status.controller_name + '\/([0-9]+)$'\r
+ _this.route(///#{r}///, _status.event_name)\r
\r
\r
<script type="text/template" id="folders-summary">\r
</script>\r
+<script type="text/template" id="scrolls-show">\r
+show\r
+</script>\r
<script type="text/template" id="scrolls-summary">\r
</script>\r
<script type="text/template" id="scroll_panels-summary">\r