From ff08b156217d1a9f1faf3f1bb63c7d8600b28cb4 Mon Sep 17 00:00:00 2001 From: Edward4j Date: Thu, 12 Feb 2015 18:38:37 +0200 Subject: [PATCH 1/7] add visual components to folders view --- app/views/folders/index.html.slim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/folders/index.html.slim b/app/views/folders/index.html.slim index 433ca6a..6973d45 100644 --- a/app/views/folders/index.html.slim +++ b/app/views/folders/index.html.slim @@ -1,5 +1,9 @@ h1 Folders +span.glyphicon.glyphicon-plus +.glyphicon.glyphicon-folder-close + = nested_folders @folders.arrange(:order => :created_at) -= render "form" += render "form" \ No newline at end of file From dabd2ed1079d76757ad3030120a76d7465528d7a Mon Sep 17 00:00:00 2001 From: Edward4j Date: Fri, 13 Feb 2015 01:29:53 +0200 Subject: [PATCH 2/7] add folder icon --- app/views/folders/_folder.html.slim | 9 ++++++--- app/views/folders/index.html.slim | 10 ++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/views/folders/_folder.html.slim b/app/views/folders/_folder.html.slim index 0a71b25..e378eb2 100644 --- a/app/views/folders/_folder.html.slim +++ b/app/views/folders/_folder.html.slim @@ -1,9 +1,12 @@ .folder - .created_at + .glyphicon.glyphicon-folder-close.name + - if folder.has_children? + = folder.name + /.created_at = folder.created_at.strftime("%B %d, %Y") - .name + = folder.name .actions - = link_to "Create subfolder", new_folder_path(parent_id: folder) + = link_to "Create subfolder", new_folder_path(parent_id: folder) = "|" = link_to "Destroy", folder, method: :delete, data: {confirm: "Are you sure?"} diff --git a/app/views/folders/index.html.slim b/app/views/folders/index.html.slim index 6973d45..694c96b 100644 --- a/app/views/folders/index.html.slim +++ b/app/views/folders/index.html.slim @@ -1,9 +1,11 @@ h1 Folders -span.glyphicon.glyphicon-plus -.glyphicon.glyphicon-folder-close - +/span.glyphicon.glyphicon-plus +a href="#" + span.glyphicon.glyphicon-folder-close + + = nested_folders @folders.arrange(:order => :created_at) = render "form" \ No newline at end of file From 27736c5a3841945d3ea6be8bf242c5b497d9e05b Mon Sep 17 00:00:00 2001 From: Edward4j Date: Sat, 14 Feb 2015 03:20:10 +0200 Subject: [PATCH 3/7] add links to folders --- app/views/folders/_folder.html.slim | 5 ++++- app/views/folders/index.html.slim | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/views/folders/_folder.html.slim b/app/views/folders/_folder.html.slim index e378eb2..44cbf32 100644 --- a/app/views/folders/_folder.html.slim +++ b/app/views/folders/_folder.html.slim @@ -1,7 +1,10 @@ .folder - .glyphicon.glyphicon-folder-close.name + - if folder.has_children? + .glyphicon.glyphicon-plus + .glyphicon.glyphicon-folder-close = folder.name + /.created_at = folder.created_at.strftime("%B %d, %Y") diff --git a/app/views/folders/index.html.slim b/app/views/folders/index.html.slim index 694c96b..b0f37e1 100644 --- a/app/views/folders/index.html.slim +++ b/app/views/folders/index.html.slim @@ -1,11 +1,18 @@ h1 Folders /span.glyphicon.glyphicon-plus -a href="#" - span.glyphicon.glyphicon-folder-close = nested_folders @folders.arrange(:order => :created_at) -= render "form" \ No newline at end of file += render "form" + +- @folders.each do |f| + - if f.has_children? + span.glyphicon.glyphicon-plus + + + = link_to f.name, f, class: 'glyphicon glyphicon-folder-close' + + From 330c63bbd4f85db701d1dead7ebb244b59aa4b5f Mon Sep 17 00:00:00 2001 From: Edward4j Date: Wed, 18 Feb 2015 00:09:05 +0200 Subject: [PATCH 4/7] add shared dir --- app/assets/javascripts/folder.coffee | 8 ++++++++ app/views/shared/_menu.html.slim | 6 ++++++ app/views/shared/_tree.html.slim | 11 +++++++++++ app/views/static_pages/landing.html.slim | 8 +++++++- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 app/views/shared/_menu.html.slim create mode 100644 app/views/shared/_tree.html.slim diff --git a/app/assets/javascripts/folder.coffee b/app/assets/javascripts/folder.coffee index 24f83d1..23f56c3 100644 --- a/app/assets/javascripts/folder.coffee +++ b/app/assets/javascripts/folder.coffee @@ -1,3 +1,11 @@ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ + +$ -> + $('.tree_menu').delegate ".toggleable_folder", "click", -> + target = $(this) + if target.hasClass('glyphicon-plus') + target.removeClass('glyphicon-plus').addClass('glyphicon-minus') + else if target.hasClass('glyphicon-minus') + target.addClass('glyphicon-plus').removeClass('glyphicon-minus') \ No newline at end of file diff --git a/app/views/shared/_menu.html.slim b/app/views/shared/_menu.html.slim new file mode 100644 index 0000000..4a8df98 --- /dev/null +++ b/app/views/shared/_menu.html.slim @@ -0,0 +1,6 @@ +.tree_menu + .panel + .panel-heading + h4 Folders + .list-group + = render 'shared/tree', :folders => Folder.roots.order("title asc") \ No newline at end of file diff --git a/app/views/shared/_tree.html.slim b/app/views/shared/_tree.html.slim new file mode 100644 index 0000000..9b116e4 --- /dev/null +++ b/app/views/shared/_tree.html.slim @@ -0,0 +1,11 @@ +ul + - folders.each do |folder| + li + - if folder.has_children? + span.glyphicon.toggleable_folder class=( @folder && @folder.ancestor_ids.include?(folder.id) ? 'glyphicon-minus' : "glyphicon-plus" ) + - else + span.glyphicon + '  + = link_to "#{content_tag(:span, folder.name)}".html_safe, folder_path(folder) + - if folder.has_children? + = render 'shared/tree', :folders => folder.children.order("created_at asc") \ No newline at end of file diff --git a/app/views/static_pages/landing.html.slim b/app/views/static_pages/landing.html.slim index 5054d0c..af0dda0 100644 --- a/app/views/static_pages/landing.html.slim +++ b/app/views/static_pages/landing.html.slim @@ -1 +1,7 @@ -h1= @greeting \ No newline at end of file +h1= @greeting + += render "shared/menu" + +/folder +/= nested_folders Folder.all.arrange(:order => :created_at) + From 67b1051dacc8e7ba811b7400b1b275145d1aa6ec Mon Sep 17 00:00:00 2001 From: Edward4j Date: Thu, 19 Feb 2015 02:33:19 +0200 Subject: [PATCH 5/7] correct folder order --- app/views/shared/_menu.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/_menu.html.slim b/app/views/shared/_menu.html.slim index 4a8df98..b468fcd 100644 --- a/app/views/shared/_menu.html.slim +++ b/app/views/shared/_menu.html.slim @@ -3,4 +3,4 @@ .panel-heading h4 Folders .list-group - = render 'shared/tree', :folders => Folder.roots.order("title asc") \ No newline at end of file + = render 'shared/tree', :folders => Folder.roots.order("created_at asc") \ No newline at end of file From a373cb1a101fab49d3e36fcea530f9d0bec2d207 Mon Sep 17 00:00:00 2001 From: Edward4j Date: Thu, 19 Feb 2015 03:21:57 +0200 Subject: [PATCH 6/7] add style to folders --- app/assets/stylesheets/application.css.scss | 19 ++++++++++++++++++- app/assets/stylesheets/folders.css.scss | 6 ++++++ app/views/shared/_tree.html.slim | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 639fc45..8743c7e 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -23,4 +23,21 @@ body{ .nested_folders { margin-left: 30px; -} \ No newline at end of file +} + + ul { + list-style-type: none; + .glyphicon { + cursor: pointer; + } + a { + color: black; + text-decoration: none; + span:hover { + text-decoration: underline; + } + }; + }; + li > ul { + list-style-type: none; + }; \ No newline at end of file diff --git a/app/assets/stylesheets/folders.css.scss b/app/assets/stylesheets/folders.css.scss index bd31bb2..5594a2a 100644 --- a/app/assets/stylesheets/folders.css.scss +++ b/app/assets/stylesheets/folders.css.scss @@ -2,3 +2,9 @@ // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ +.glyphicon-minus ~ ul { + display: block; +} +.glyphicon-plus ~ ul { + display: none; +}; \ No newline at end of file diff --git a/app/views/shared/_tree.html.slim b/app/views/shared/_tree.html.slim index 9b116e4..00fa378 100644 --- a/app/views/shared/_tree.html.slim +++ b/app/views/shared/_tree.html.slim @@ -6,6 +6,6 @@ ul - else span.glyphicon '  - = link_to "#{content_tag(:span, folder.name)}".html_safe, folder_path(folder) + = link_to "#{content_tag(:span, "", :class => 'glyphicon glyphicon-folder-close')} #{content_tag(:span, folder.name)}".html_safe, folder_path(folder) - if folder.has_children? = render 'shared/tree', :folders => folder.children.order("created_at asc") \ No newline at end of file From 7603f1973445cf6987baf8c62433c14339eba9d1 Mon Sep 17 00:00:00 2001 From: Edward4j Date: Fri, 20 Feb 2015 13:06:30 +0200 Subject: [PATCH 7/7] add css for tree view folders --- app/assets/stylesheets/application.css.scss | 36 +++++++++++++-------- app/assets/stylesheets/folders.css.scss | 9 +----- app/views/folders/_folder.html.slim | 12 ++----- app/views/folders/index.html.slim | 13 -------- app/views/shared/_tree.html.slim | 2 +- 5 files changed, 27 insertions(+), 45 deletions(-) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 8743c7e..fb2523b 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -25,19 +25,27 @@ body{ margin-left: 30px; } - ul { - list-style-type: none; - .glyphicon { - cursor: pointer; +.list-group { + ul { + list-style-type: none; + .glyphicon { + cursor: pointer; + } + a { + color: black; + text-decoration: none; + span:hover { + text-decoration: underline; } - a { - color: black; - text-decoration: none; - span:hover { - text-decoration: underline; - } - }; }; - li > ul { - list-style-type: none; - }; \ No newline at end of file + }; + li > ul { + list-style-type: none; + }; + .glyphicon-minus ~ ul { + display: block; + } + .glyphicon-plus ~ ul { + display: none; + }; +}; \ No newline at end of file diff --git a/app/assets/stylesheets/folders.css.scss b/app/assets/stylesheets/folders.css.scss index 5594a2a..798676a 100644 --- a/app/assets/stylesheets/folders.css.scss +++ b/app/assets/stylesheets/folders.css.scss @@ -1,10 +1,3 @@ // Place all the styles related to the folder controller here. // They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ - -.glyphicon-minus ~ ul { - display: block; -} -.glyphicon-plus ~ ul { - display: none; -}; \ No newline at end of file +// You can use Sass (SCSS) here: http://sass-lang.com/ \ No newline at end of file diff --git a/app/views/folders/_folder.html.slim b/app/views/folders/_folder.html.slim index 44cbf32..0a71b25 100644 --- a/app/views/folders/_folder.html.slim +++ b/app/views/folders/_folder.html.slim @@ -1,15 +1,9 @@ .folder - - - if folder.has_children? - .glyphicon.glyphicon-plus - .glyphicon.glyphicon-folder-close - = folder.name - - /.created_at + .created_at = folder.created_at.strftime("%B %d, %Y") - + .name = folder.name .actions - = link_to "Create subfolder", new_folder_path(parent_id: folder) + = link_to "Create subfolder", new_folder_path(parent_id: folder) = "|" = link_to "Destroy", folder, method: :delete, data: {confirm: "Are you sure?"} diff --git a/app/views/folders/index.html.slim b/app/views/folders/index.html.slim index b0f37e1..433ca6a 100644 --- a/app/views/folders/index.html.slim +++ b/app/views/folders/index.html.slim @@ -1,18 +1,5 @@ h1 Folders -/span.glyphicon.glyphicon-plus - - = nested_folders @folders.arrange(:order => :created_at) = render "form" - -- @folders.each do |f| - - if f.has_children? - span.glyphicon.glyphicon-plus - - - = link_to f.name, f, class: 'glyphicon glyphicon-folder-close' - - diff --git a/app/views/shared/_tree.html.slim b/app/views/shared/_tree.html.slim index 00fa378..05150d8 100644 --- a/app/views/shared/_tree.html.slim +++ b/app/views/shared/_tree.html.slim @@ -2,7 +2,7 @@ ul - folders.each do |folder| li - if folder.has_children? - span.glyphicon.toggleable_folder class=( @folder && @folder.ancestor_ids.include?(folder.id) ? 'glyphicon-minus' : "glyphicon-plus" ) + span.glyphicon.toggleable_folder class=(@folder && @folder.ancestor_ids.include?(folder.id) ? 'glyphicon-minus' : "glyphicon-plus" ) - else span.glyphicon '