Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/assets/javascripts/folder.coffee
Original file line number Diff line number Diff line change
@@ -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')
27 changes: 26 additions & 1 deletion app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,29 @@ body{

.nested_folders {
margin-left: 30px;
}
}

.list-group {
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;
};
.glyphicon-minus ~ ul {
display: block;
}
.glyphicon-plus ~ ul {
display: none;
};
};
3 changes: 1 addition & 2 deletions app/assets/stylesheets/folders.css.scss
Original file line number Diff line number Diff line change
@@ -1,4 +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/

// You can use Sass (SCSS) here: http://sass-lang.com/
6 changes: 6 additions & 0 deletions app/views/shared/_menu.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.tree_menu
.panel
.panel-heading
h4 Folders
.list-group
= render 'shared/tree', :folders => Folder.roots.order("created_at asc")
11 changes: 11 additions & 0 deletions app/views/shared/_tree.html.slim
Original file line number Diff line number Diff line change
@@ -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
'&nbsp
= 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")
8 changes: 7 additions & 1 deletion app/views/static_pages/landing.html.slim
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
h1= @greeting
h1= @greeting

= render "shared/menu"

/folder
/= nested_folders Folder.all.arrange(:order => :created_at)