Przeglądaj źródła

Added edit room description to manageStation page.

KrisVos130 9 lat temu
rodzic
commit
1749ff55c1

+ 2 - 0
.gitignore

@@ -1 +1,3 @@
 .idea
+app/mup.json
+app/settings.json

+ 14 - 0
app/client/scripts/events.js

@@ -641,6 +641,20 @@ Template.queues.events({
 
 Template.manageStation.events({
     /* TODO Add undo delete button */
+    "click #editDescButton": function() {
+        var parts = location.href.split('/');
+        parts.pop();
+        var id = parts.pop();
+        var type = id.toLowerCase();
+        var editingDesc = Session.get("editingDesc");
+        if (!editingDesc) {
+            Session.set("editingDesc", !editingDesc);
+        } else {
+            var newDesc = $("#editDesc").val();
+            Meteor.call("editRoomDesc", type, newDesc);
+            Session.set("editingDesc", !editingDesc);
+        }
+    },
     "input #id": function() {
         $("#previewPlayerContainer").addClass("hide-preview");
     },

+ 6 - 4
app/client/templates/manageStation.html

@@ -3,18 +3,20 @@
     <div class="landing">
         {{> header}}
         <div class="row">
-            <div class="col m8 s8 l8 offset-l2 offset-m1 offset-s2 admin-playlist-panel card-panel teal accent-3">
+            <div class="col m12 s12 l8 offset-l2 admin-playlist-panel card-panel teal accent-3">
                 <div class="card-content white-text">
                     <h3 class="text-center">Description</h3>
-                    Meteor.call("editRoomDesc", Session.get("roomDesc"), description);
+                    <!--Meteor.call("editRoomDesc", Session.get("roomDesc"), description);-->
                     {{#if editingDesc}}
-                        <input val="{{description}}" id="editDesc"/>
+                        <input value="{{description}}" id="editDesc"/>
+                        <a class="waves-effect waves-light btn" id="editDescButton" style="margin-bottom: 10px;">Save</a>
                     {{else}}
                         <h5>{{description}}</h5>
+                        <a class="waves-effect waves-light btn" id="editDescButton" style="margin-bottom: 10px;">Edit</a>
                     {{/if}}
                 </div>
             </div>
-            <div class="col m8 s8 l8 offset-l2 offset-m1 offset-s2 admin-playlist-panel card-panel teal accent-3">
+            <div class="col m12 s12 l8 offset-l2 admin-playlist-panel card-panel teal accent-3">
                 <div class="card-content white-text">
                     <h3 class="text-center">{{display}} playlist</h3>
                     <table class="bordered">