From 83f1f7821de58635a9c85a1f469abadfb49d3ee2 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Thu, 28 Aug 2014 09:03:44 +0200 Subject: [PATCH 1/2] show edit controls on click --- .../app/controllers/ticket_zoom.js.coffee | 11 +++ .../app/views/ticket_zoom/edit.jst.eco | 48 +++++----- app/assets/stylesheets/zzz.css.erb | 93 +++++++++++-------- 3 files changed, 88 insertions(+), 64 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index 90fc0c629..eb3e59ede 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -318,6 +318,8 @@ class Edit extends App.Controller 'click .visibility.toggle': 'toggle_visibility' 'click .pop-selectable': 'select_type' 'click .pop-selected': 'show_selectable_types' + 'focus textarea': 'show_controls' + 'blur textarea': 'hide_controls' constructor: -> super @@ -466,6 +468,15 @@ class Edit extends App.Controller @type = type typeIcon.addClass @type + show_controls: => + @el.addClass('mode--edit') + # scroll to bottom + @el.scrollParent().scrollTop(99999) + + hide_controls: => + if !@el.find('textarea').val() + @el.removeClass('mode--edit') + autosaveStop: => @clearInterval( 'autosave' ) diff --git a/app/assets/javascripts/app/views/ticket_zoom/edit.jst.eco b/app/assets/javascripts/app/views/ticket_zoom/edit.jst.eco index 5018fde3d..1cd3fb312 100644 --- a/app/assets/javascripts/app/views/ticket_zoom/edit.jst.eco +++ b/app/assets/javascripts/app/views/ticket_zoom/edit.jst.eco @@ -2,31 +2,33 @@
-
-
-
-
-
-
-
- -
-
- -
-
- -
-
-
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
-
-
-
-
-
+
+
+
+
+
@@ -37,7 +39,7 @@ Antwort eingeben oder Dateien wählen
- +
\ No newline at end of file diff --git a/app/assets/stylesheets/zzz.css.erb b/app/assets/stylesheets/zzz.css.erb index 4f5618bc1..9be36a983 100644 --- a/app/assets/stylesheets/zzz.css.erb +++ b/app/assets/stylesheets/zzz.css.erb @@ -1593,7 +1593,7 @@ footer { .btn { font-size: 14px; - padding: 9px 14px; + padding: 9px 24px 8px; } .btn.primary, @@ -2536,45 +2536,6 @@ footer { border-color: hsl(300,43%,84%); } - .ticket-edit .text-bubble { - padding: 0; - border-color: #b3b3b3; - white-space: normal; - border-radius: 5px; - } - - .ticket-edit textarea { - width: 100%; - height: 38px; - padding: 10px 20px; - vertical-align: bottom; - border: none; - background: none; - outline: none; - transition: 500ms; - } - - .ticket-edit textarea:focus { - height: 105px; - } - - .ticket-edit textarea:focus + .bubble-placeholder { - display: none; - } - - .ticket-edit .bubble-arrow:after { - border-color: #b3b3b3; - box-shadow: none; - } - - .bubble-placeholder { - position: absolute; - color: #b3b3b3; - left: 20px; - top: 10px; - pointer-events: none; - } - .bubble-arrow { position: absolute; width: 7px; @@ -2648,6 +2609,10 @@ footer { margin-bottom: 37px; } + .ticket-edit.mode--edit { + margin-bottom: 12px; + } + .bottom-form { background: white; } @@ -2667,6 +2632,14 @@ footer { margin-bottom: 3px; } + .ticket-edit .edit-controls { + display: none; + } + + .ticket-edit.mode--edit .edit-controls { + display: block; + } + .ticket-edit .pop-selectable .icon { opacity: 0.3; pointer-events: none; @@ -2705,6 +2678,44 @@ footer { display: none; } + .ticket-edit .text-bubble { + padding: 0; + border-color: #b3b3b3; + white-space: normal; + border-radius: 5px; + } + + .ticket-edit textarea { + width: 100%; + height: 38px; + padding: 10px 20px; + vertical-align: bottom; + border: none; + background: none; + outline: none; + } + + .ticket-edit.mode--edit textarea { + height: 115px; + } + + .ticket-edit.mode--edit .bubble-placeholder { + display: none; + } + + .ticket-edit .bubble-arrow:after { + border-color: #b3b3b3; + box-shadow: none; + } + + .bubble-placeholder { + position: absolute; + color: #b3b3b3; + left: 20px; + top: 10px; + pointer-events: none; + } + .pop-select { position: relative; z-index: 2; @@ -2718,7 +2729,7 @@ footer { .pop-selected, .pop-selectable { - width: 36px; + width: 38px; height: 36px; } From 588a0a6cf4b9b87367663d0c65c3ab4491496c12 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Thu, 28 Aug 2014 09:09:37 +0200 Subject: [PATCH 2/2] toggle sidebar when clicking the same again --- .../app/controllers/ticket_zoom.js.coffee | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index eb3e59ede..4b2687d2b 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -294,13 +294,17 @@ class Sidebar extends App.Controller toggleTab: (e) -> name = $(e.target).closest('.sidebar-tab').data('content') + if name - @el.find('.ticket-zoom .sidebar-tab').removeClass('active') - $(e.target).closest('.sidebar-tab').addClass('active') + if name is @currentTab + @toggleSidebar() + else + @el.find('.ticket-zoom .sidebar-tab').removeClass('active') + $(e.target).closest('.sidebar-tab').addClass('active') - @toggleContent(name) + @toggleContent(name) - @showSidebar() + @showSidebar() toggleContent: (name) -> @@ -309,6 +313,7 @@ class Sidebar extends App.Controller @el.find('.sidebar-content[data-content=' + name + ']').removeClass('hide') title = @el.find('.sidebar-content[data-content=' + name + ']').data('title') @el.find('.sidebar h2').html(title) + @currentTab = name class Edit extends App.Controller