@action_name + '/'\r
'/' + this.filer().item_class.path_name() + '/' + a\r
\r
- js_action_path: () ->\r
- a = if @action_name == 'show'\r
- ''\r
- else\r
- @action_name + '/'\r
- this.filer().item_class.path_name() + '/' + a\r
- \r
this.$el.html('')\r
this.$el.append(@header.render().el)\r
this.$el.append(@body.render().el)\r
- this.$el.append(@pager.render().el) if @pager\r
+ this.$el.append(@pager.el) if @pager\r
this\r
\r
model: () ->\r
"javascript:void(0)"\r
\r
url: () ->\r
- @my_manifest.js_action_path() + @item.get('id').toString()\r
+ controller = Manifest.manifest().controllers[@item.table_name()]\r
+ action = controller.actions[@my_manifest.action_name]\r
+ params = {\r
+ controller: controller,\r
+ action: action,\r
+ id: @item.get('id'),\r
+ format: 'html'\r
+ }\r
+ '/' + action.url(params)\r
\r
"javascript:void(0)"\r
\r
url: () ->\r
- @my_manifest.js_action_path() + @item.get('id').toString()\r
+ controller = Manifest.manifest().controllers[@item.table_name()]\r
+ action = controller.actions[@my_manifest.action_name]\r
+ params = {\r
+ controller: controller,\r
+ action: action,\r
+ id: @item.get('id'),\r
+ format: 'html'\r
+ }\r
+ '/' + action.url(params)\r
\r
className: 'pagination'\r
\r
initialize: (options) ->\r
- @filer = options.filer\r
- @counter = @list_result.counter\r
- @current_page = @list_result.page\r
- @per_page = @list_result.page_size\r
- @total_page = (@total / @per_page) + 1\r
- @window_size = 3\r
+ @page_status = options.page_status\r
+ @counter = @page_status.counter\r
+ @current_page = @page_status.current_page\r
+ @per_page = @page_status.per_page\r
+ @window_size = @page_status.window_size\r
@parts = []\r
_this = this\r
@counter.fetch().done ->\r
- _this.total = @counter.count\r
- _this.build()\r
+ _this.total = _this.counter.get('count')\r
+ _this.total_page = Math.floor(_this.total / _this.per_page) + 1\r
_this.render()\r
\r
render: () ->\r
+ @parts = []\r
+ @build()\r
_this = this\r
this.$el.html('')\r
_.each @parts, (part) ->\r
_this.$el.append(part.render().el)\r
+ this.$el.append(div('row_break').render().el)\r
this\r
\r
build: () ->\r
- @parts.push(new Locmare.FilerModule.DefaultPager.FirstPage({})) if hasPreviousPage()\r
- @parts.push(new Locmare.FilerModule.DefaultPager.PrevPage({})) if hasPreviousPage()\r
- @parts.push(new Locmare.FilerModule.DefaultPager.PageGap({})) if hasPreviousPageGap()\r
+ @parts.push(new Locmare.FilerModule.DefaultPager.FirstPage({})) if @hasPreviousPage()\r
+ @parts.push(new Locmare.FilerModule.DefaultPager.PrevPage({})) if @hasPreviousPage()\r
+ @parts.push(new Locmare.FilerModule.DefaultPager.PageGap({})) if @hasPreviousPageGap()\r
f = if @hasPreviousPageGap()\r
@current_page - @window_size\r
else\r
@total_page\r
for page in [f..t]\r
@parts.push(new Locmare.FilerModule.DefaultPager.Page({page: page}))\r
- @parts.push(new Locmare.FilerModule.DefaultPager.NextPageGap({})) if hasNextPageGap()\r
- @parts.push(new Locmare.FilerModule.DefaultPager.NextPage({})) if hasNextPage()\r
- @parts.push(new Locmare.FilerModule.DefaultPager.LastPage({})) if hasNextPage()\r
+ @parts.push(new Locmare.FilerModule.DefaultPager.PageGap({})) if @hasNextPageGap()\r
+ @parts.push(new Locmare.FilerModule.DefaultPager.NextPage({})) if @hasNextPage()\r
+ @parts.push(new Locmare.FilerModule.DefaultPager.LastPage({})) if @hasNextPage()\r
\r
hasPreviousPage: () ->\r
@current_page > 1\r
tagName: 'li'\r
className: 'page'\r
\r
+ initialize: (options) ->\r
+ @page = options.page\r
+ \r
render: () ->\r
- this.$el.html()\r
+ this.$el.html(@page)\r
this\r
\r
class Locmare.FilerModule.DefaultPager.NextPage extends Backbone.View\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
+ new Pettanr.AppHelperImg({src: @r_url(), size: wh[0]})\r
\r
tail_opt_img_tag: (img) ->\r
{src: img, width: @get('width'), height: @get('height')}\r
ln = Pettanr.to_s(@license().get('caption'))\r
lgn + '[' + ln + ']'\r
\r
- symbol_option: () ->\r
- this\r
+ symbol_option: (cb) ->\r
+ _this = this\r
+ this.fetch().done ->\r
+ cb(_this.tmb_opt_img_tag())\r
\r
is_enable: () ->\r
if @head().resource_picture()\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
+ new Pettanr.AppHelperImg({src: @r_url(), size: wh[0], alt: @get('caption')})\r
\r
opt_img_tag: () ->\r
{src: @url('full'), width: @get('width'), height: @get('height')}\r
count: () ->\r
@get('count')\r
\r
- class Pettanr.Pager extends Backbone.View\r
+ class Pettanr.PageStatus\r
\r
- initialize: (options) ->\r
+ constructor: (options) ->\r
@action = options['action']\r
@params = options['params']\r
- @current_page = @params['page']\r
- @per_page = @params['page_size']\r
+ @current_page = @params['page'] || 1\r
+ @per_page = @params['page_size'] || 25\r
@window_size = 3\r
@counter = new Pettanr.CounterModel({}, {url: '/' + @action.counter_url(@params)})\r
- _this = this\r
- @counter.fetch().done ->\r
- _this.total_page = (@total / _this.per_page) + 1\r
\r
class Pettanr.FilerCollection extends Backbone.Collection\r
\r
@set_model()\r
@my_list_model = Manifest.manifest().models[@my_action.item_name]\r
@my_list_model_class = @my_list_model.classify()\r
- @pager = new Pettanr.Pager({action: @my_action, params: @params})\r
- @list = new Pettanr.FilerCollection({}, {model: @my_list_model_class, action: @my_action, params: @params})\r
+ @list_options = {\r
+ model: @my_list_model_class, \r
+ action: @my_action, \r
+ params: @params\r
+ }\r
+ @page_status = new Pettanr.PageStatus(@list_options)\r
+ @list = new Pettanr.FilerCollection({}, @list_options)\r
\r
set_show: () ->\r
@set_model()\r
\r
filer_list: () ->\r
@set_list()\r
+ @pager = new Locmare.FilerModule.DefaultPager({page_status: @page_status})\r
f = new Locmare.Filer({\r
el: "#pettanr",\r
item_name: @my_list_model_class.item_name(), \r
}
.filer-item-speech_balloon_template .filer-item-caption {
}
+
+ul.pagination {
+ list-style-type: none;
+}
+
+ul.pagination li {
+ float: left;
+}
+
def show_prof_format format
format.prof {
self.formats = [:html]
- @profiler = Locmare::Profiler.new @my_model.item_name, @item, @operators
+ @profiler = Locmare::Profiler.new @my_model_class.item_name, @item, @operators
render @profiler.template_name, :locals => {
:profiler => @profiler
}
<p>
<b><%= t_m 'Panel.publish' -%>:</b>
- <%= t_selected_item('panel_visible_items', @item.publish) %>
+ <%= t_selected_item('panel_publish_items', @item.publish) %>
</p>
<p>
<%= link_to t('link.edit'), edit_panel_path(@item) %>
<div id="pettanr">\r
</div>\r
-<div id="f1">\r
- <a href="#" class="btn">filer</a>\r
-</div>\r
-<script type="text/javascript" id="manifest">\r
- author_id = <%= @operators.author.id -%>;\r
- artist_id = <%= @operators.artist.id -%>;\r
-</script>\r
-<script type="text/javascript" id="manifest">\r
-</script>\r
-<script type="text/javascript" id="local-manifest">\r
-</script>\r
<script type="text/template" id="templates-filer-filer">\r
<&= filer.header.render().el.innerHTML &>\r
<&= filer.body.render().el.innerHTML &>\r
<div id="pettanr">\r
</div>\r
-<div id="f1">\r
- <a href="#" class="btn">filer</a>\r
-</div>\r
<script type="text/javascript" id="manifest">\r
author_id = <%= @operators.author.id -%>;\r
artist_id = <%= @operators.artist.id -%>;\r