2
0
Эх сурвалжийг харах

Merge remote-tracking branch 'origin/february_release' into february_release

KrisVos130 9 жил өмнө
parent
commit
17e340ca50

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

@@ -202,6 +202,16 @@ Template.admin.events({
     "click #rreset_confirm": function(){
         $('#confirmModal').modal('hide');
         Meteor.call("resetRating");
+    },
+    "click #edit_desc": function(){
+        console.log($(this));
+        console.log($(this)[0].type);
+        Session.set("roomDesc", $(this)[0].type);
+    },
+    "click #submit_desc": function(){
+        var description = $("#desc_text").val();
+        Meteor.call("editRoomDesc", Session.get("roomDesc"), description);
+        $("#desc-modal").closeModal();
     }
 });
 

+ 4 - 2
app/client/stylesheets/app.css

@@ -154,7 +154,6 @@ textarea{
     margin-bottom: 20px;
 }
 
-
 .seeker-bar {
     top: 0;
     left: 0;
@@ -168,9 +167,12 @@ textarea{
     display: block;
     width: 100%;
     overflow: hidden;
-
 }
 
 #preview-time {
     margin-top: -9px;
+}
+
+#desc_text{
+    color: black;
 }

+ 21 - 1
app/client/templates/admin.html

@@ -28,6 +28,7 @@
                                     <td></td>
                                     <td>{{reportsCount display}}</td>
                                     <td>{{queueCount display}}</td>
+                                    <td><a id="edit_desc" class="btn right modal-trigger" href="#desc-modal">Edit Desc.</a></td>
                                     <td><a href="/{{type}}/manage" class="btn right" id="manage-{{display}}">Manage</a></td> <!-- TODO Make this redirect to playlist -->
                                 </tr>
                             {{/each}}
@@ -85,7 +86,7 @@
     <script>
         $(document).ready(function(){
             // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
-            $('#new_room').leanModal();
+            $('.modal-trigger').leanModal();
         });
     </script>
 
@@ -107,4 +108,23 @@
             </div>
         </div>
     </div>
+    <div id="desc-modal" class="modal fade" role="dialog">
+        <div class="modal-dialog">
+            <!-- Modal content-->
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h4 class="modal-title">Edit Room Description</h4>
+                </div>
+                <div class="modal-body">
+                    <div class="input-field">
+                        <textarea id="desc_text" class="materialize-textarea"></textarea>
+                    </div>
+                    <a id="submit_desc" class="waves-effect waves-light btn">Submit</a>
+                </div>
+                <div class="modal-footer">
+                    <button id="close-modal" type="button" class="btn btn-default waves-effect waves-light" data-dismiss="modal">Close</button>
+                </div>
+            </div>
+        </div>
+    </div>
 </template>

+ 2 - 2
app/client/templates/home.html

@@ -19,8 +19,8 @@
                             <p><span class="user-num">{{userNum}}</span> <i class="material-icons">perm_identity</i></p>
                             </div>
                             <div class="card-reveal">
-                                <span class="card-title grey-text text-darken-4">{{display}}<i
-                                        class="material-icons right">close</i></span>
+                                <span class="card-title grey-text text-darken-4">{{display}}<i class="material-icons right">close</i></span>
+                                {{roomDesc}}
                             </div>
                         </div>
                     </div>

+ 14 - 5
app/client/templates/manageStation.html

@@ -67,18 +67,21 @@
                 <button id="pause" title="Pause video" class="btn orange col m1 s1 l1" disabled>
                     <i class="material-icons">pause</i>
                 </button>
-                <button id="forward" title="Go to the last 10 seconds of the video" class="btn blue col m1 s1 l1" disabled>
+                <button id="forward" title="Go to the last 10 seconds of the video" class="btn blue col m1 s1 l1"
+                        disabled>
                     <i class="material-icons">fast_forward</i>
                 </button>
                 <form class="col m2 s2 l2" action="#">
                     <p class="range-field" style="margin-top: 0">
-                        <input type="range" id="volume_slider" min="0" max="100" />
+                        <input type="range" id="volume_slider" min="0" max="100"/>
                     </p>
                 </form>
             </div>
             <div class="row">
                 <h4 class="center-align">Image Preview</h4>
-                <img id="song-preview" onerror="this.src='http://static.boredpanda.com/blog/wp-content/uploads/2014/04/amazing-fox-photos-182.jpg'" class="center-block" src="{{song_image}}"/>
+                <img id="song-preview"
+                     onerror="this.src='http://static.boredpanda.com/blog/wp-content/uploads/2014/04/amazing-fox-photos-182.jpg'"
+                     class="center-block" src="{{song_image}}"/>
             </div>
             <div class="row">
                 <h4 class="center-align">Edit Info</h4>
@@ -129,8 +132,14 @@
                 </div>
             </div>
             <div class="row">
-                <button type="button" id="get-spotify-info" class="btn btn-large col l6 m6 s10 offset-l3 offset-m3 offset-s1 waves-effect waves-light">Get Spotify Data</button>
-                <button type="button" id="save-song-button" class="btn btn-large col l6 m6 s10 offset-l3 offset-m3 offset-s1 waves-effect waves-light">Save Changes</button>
+                <button type="button" id="get-spotify-info"
+                        class="btn btn-large col l6 m6 s10 offset-l3 offset-m3 offset-s1 waves-effect waves-light">Get
+                    Spotify Data
+                </button>
+                <button type="button" id="save-song-button"
+                        class="btn btn-large col l6 m6 s10 offset-l3 offset-m3 offset-s1 waves-effect waves-light">Save
+                    Changes
+                </button>
             </div>
 
         </div>

+ 5 - 1
app/database/schemas.js

@@ -242,6 +242,10 @@ Schemas.Room = new SimpleSchema({
         type: Boolean,
         defaultValue: false,
         label: "Room private or not"
+    },
+    roomDesc: {
+        type: String,
+        label: "Room description"
     }
 });
 
@@ -507,4 +511,4 @@ Queues.attachSchema(Schemas.QueueSong);
 Meteor.users.attachSchema(Schemas.User);
 Reports.attachSchema(Schemas.Report);
 Feedback.attachSchema(Schemas.Feedback);
-Songs.attachSchema(Schemas.FullSong);
+Songs.attachSchema(Schemas.FullSong);

+ 7 - 0
app/server/server.js

@@ -1162,6 +1162,13 @@ Meteor.methods({
         } else {
             throw new Meteor.Error(403, "Invalid permissions.");
         }
+    },
+    editRoomDesc: function(type, description){
+        if(isAdmin() && !isBanned()){
+            Rooms.update({type: type}, {$set: {"roomDesc": description}});
+        } else {
+            throw new Meteor.Error(403, "Invalid permissions.");
+        }
     }
 });