Class: Page
- Inherits:
-
Object
- Object
- Page
- Defined in:
- lib/sinatra/directory_listing/page.rb
Instance Attribute Summary collapse
-
#current_page ⇒ Object
Class definition for the page to be generated.
-
#embed_in ⇒ Object
Class definition for the page to be generated.
-
#favicon ⇒ Object
Class definition for the page to be generated.
-
#file_sort_link ⇒ Object
Class definition for the page to be generated.
-
#filename_truncate_length ⇒ Object
Class definition for the page to be generated.
-
#files_html ⇒ Object
Class definition for the page to be generated.
-
#last_modified_format ⇒ Object
Class definition for the page to be generated.
-
#mtime_sort_link ⇒ Object
Class definition for the page to be generated.
-
#nav_bar ⇒ Object
Generate the page’s navigation bar.
-
#public_folder ⇒ Object
Class definition for the page to be generated.
-
#readme ⇒ Object
Class definition for the page to be generated.
-
#request_params ⇒ Object
Class definition for the page to be generated.
-
#request_params_display ⇒ Object
Get URL-appendable (Hash -> String) parameters for a request.
-
#request_path ⇒ Object
Class definition for the page to be generated.
-
#should_list_invisibles ⇒ Object
Class definition for the page to be generated.
-
#should_show_file_exts ⇒ Object
Class definition for the page to be generated.
-
#size_sort_link ⇒ Object
Class definition for the page to be generated.
-
#smart_sort ⇒ Object
Class definition for the page to be generated.
-
#sort_direction ⇒ Object
Class definition for the page to be generated.
-
#sort_direction_display ⇒ Object
Class definition for the page to be generated.
-
#sort_item ⇒ Object
Class definition for the page to be generated.
-
#sort_item_display ⇒ Object
Class definition for the page to be generated.
-
#stylesheet ⇒ Object
Class definition for the page to be generated.
Instance Method Summary collapse
-
#sorting_info(s_item, s_direction) ⇒ Object
Return sorting information given an item and the sorting direction.
Instance Attribute Details
#current_page ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def current_page @current_page end |
#embed_in ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def @embed_in end |
#favicon ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def favicon @favicon end |
#file_sort_link ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def file_sort_link @file_sort_link end |
#filename_truncate_length ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def filename_truncate_length @filename_truncate_length end |
#files_html ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def files_html @files_html end |
#last_modified_format ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def last_modified_format @last_modified_format end |
#mtime_sort_link ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def mtime_sort_link @mtime_sort_link end |
#nav_bar ⇒ Object
Generate the page’s navigation bar
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def @nav_bar end |
#public_folder ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def public_folder @public_folder end |
#readme ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def readme @readme end |
#request_params ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def request_params @request_params end |
#request_params_display ⇒ Object
Get URL-appendable (Hash -> String) parameters for a request
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def request_params_display @request_params_display end |
#request_path ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def request_path @request_path end |
#should_list_invisibles ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def should_list_invisibles @should_list_invisibles end |
#should_show_file_exts ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def should_show_file_exts @should_show_file_exts end |
#size_sort_link ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def size_sort_link @size_sort_link end |
#smart_sort ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def smart_sort @smart_sort end |
#sort_direction ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def sort_direction @sort_direction end |
#sort_direction_display ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def sort_direction_display @sort_direction_display end |
#sort_item ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def sort_item @sort_item end |
#sort_item_display ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def sort_item_display @sort_item_display end |
#stylesheet ⇒ Object
Class definition for the page to be generated.
6 7 8 |
# File 'lib/sinatra/directory_listing/page.rb', line 6 def stylesheet @stylesheet end |
Instance Method Details
#sorting_info(s_item, s_direction) ⇒ Object
Return sorting information given an item and the sorting direction
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/sinatra/directory_listing/page.rb', line 91 def sorting_info(s_item, s_direction) file_link_dir = mtime_link_dir = sortby_link_dir = "ascending" s_item_display = s_direction_display = "" case s_item when "file" s_item_display = "alphabetically" case s_direction when "ascending" s_direction_display = "" file_link_dir = "descending" when "descending" s_direction_display = "reversed" file_link_dir = "ascending" end when "mtime" s_item_display = "by modification date" case s_direction when "ascending" s_direction_display = "oldest to newest" mtime_link_dir = "descending" when "descending" s_direction_display = "newest to oldest" mtime_link_dir = "ascending" end when "size" s_item_display = "by size" case s_direction when "ascending" s_direction_display = "smallest to largest" sortby_link_dir = "descending" when "descending" s_direction_display = "largest to smallest" sortby_link_dir = "ascending" end end return "?sortby=file&direction=#{file_link_dir}", "?sortby=mtime&direction=#{mtime_link_dir}", "?sortby=size&direction=#{sortby_link_dir}", s_item_display, s_direction_display end |