Browse Source

Some work on nicer rendering of chat room form.

Still needs more work. Needs <fieldset> tags.
JC Brand 9 years ago
parent
commit
4a8b5da197
4 changed files with 52 additions and 49 deletions
  1. 2 7
      converse.js
  2. 1 0
      main.js
  3. 44 42
      src/templates.js
  4. 5 0
      src/templates/chatroom_form.html

+ 2 - 7
converse.js

@@ -3185,7 +3185,7 @@
             },
 
             renderConfigurationForm: function (stanza) {
-                var $form= this.$el.find('form.chatroom-form'),
+                var $form = this.$el.find('form.chatroom-form'),
                     $stanza = $(stanza),
                     $fields = $stanza.find('field'),
                     title = $stanza.find('title').text(),
@@ -3262,12 +3262,7 @@
                     return;
                 }
                 this.$('.chatroom-body').children().hide();
-                this.$('.chatroom-body').append(
-                    $('<div class="chatroom-form-container">'+
-                        '<form class="chatroom-form">'+
-                        '<span class="spinner centered"/>'+
-                        '</form>'+
-                    '</div>'));
+                this.$('.chatroom-body').append(converse.templates.chatroom_form());
                 converse.connection.sendIQ(
                         $iq({
                             to: this.model.get('jid'),

+ 1 - 0
main.js

@@ -109,6 +109,7 @@ require.config({
         "chatarea":                 "src/templates/chatarea",
         "chatbox":                  "src/templates/chatbox",
         "chatroom":                 "src/templates/chatroom",
+        "chatroom_form":            "src/templates/chatroom_form",
         "chatroom_password_form":   "src/templates/chatroom_password_form",
         "chatroom_sidebar":         "src/templates/chatroom_sidebar",
         "chatrooms_tab":            "src/templates/chatrooms_tab",

+ 44 - 42
src/templates.js

@@ -7,6 +7,7 @@ define("converse-templates", [
     "tpl!chatarea",
     "tpl!chatbox",
     "tpl!chatroom",
+    "tpl!chatroom_form",
     "tpl!chatroom_password_form",
     "tpl!chatroom_sidebar",
     "tpl!chatrooms_tab",
@@ -59,47 +60,48 @@ define("converse-templates", [
         chatarea:               arguments[5],
         chatbox:                arguments[6],
         chatroom:               arguments[7],
-        chatroom_password_form: arguments[8],
-        chatroom_sidebar:       arguments[9],
-        chatrooms_tab:          arguments[10],
-        chats_panel:            arguments[11],
-        choose_status:          arguments[12],
-        contacts_panel:         arguments[13],
-        contacts_tab:           arguments[14],
-        controlbox:             arguments[15],
-        controlbox_toggle:      arguments[16],
-        field:                  arguments[17],
-        form_captcha:           arguments[18],
-        form_checkbox:          arguments[19],
-        form_input:             arguments[20],
-        form_select:            arguments[21],
-        form_textarea:          arguments[22],
-        form_username:          arguments[23],
-        group_header:           arguments[24],
-        info:                   arguments[25],
-        login_panel:            arguments[26],
-        login_tab:              arguments[27],
-        message:                arguments[28],
-        new_day:                arguments[29],
-        occupant:               arguments[30],
-        pending_contact:        arguments[31],
-        pending_contacts:       arguments[32],
-        register_panel:         arguments[33],
-        register_tab:           arguments[34],
-        registration_form:      arguments[35],
-        registration_request:   arguments[36],
-        requesting_contact:     arguments[37],
-        requesting_contacts:    arguments[38],
-        room_description:       arguments[39],
-        room_item:              arguments[40],
-        room_panel:             arguments[41],
-        roster:                 arguments[42],
-        roster_item:            arguments[43],
-        search_contact:         arguments[44],
-        select_option:          arguments[45],
-        status_option:          arguments[46],
-        toggle_chats:           arguments[47],
-        toolbar:                arguments[48],
-        trimmed_chat:           arguments[49]
+        chatroom_form:          arguments[8],
+        chatroom_password_form: arguments[9],
+        chatroom_sidebar:       arguments[10],
+        chatrooms_tab:          arguments[11],
+        chats_panel:            arguments[12],
+        choose_status:          arguments[13],
+        contacts_panel:         arguments[14],
+        contacts_tab:           arguments[15],
+        controlbox:             arguments[16],
+        controlbox_toggle:      arguments[17],
+        field:                  arguments[18],
+        form_captcha:           arguments[19],
+        form_checkbox:          arguments[20],
+        form_input:             arguments[21],
+        form_select:            arguments[22],
+        form_textarea:          arguments[23],
+        form_username:          arguments[24],
+        group_header:           arguments[25],
+        info:                   arguments[26],
+        login_panel:            arguments[27],
+        login_tab:              arguments[28],
+        message:                arguments[29],
+        new_day:                arguments[30],
+        occupant:               arguments[31],
+        pending_contact:        arguments[32],
+        pending_contacts:       arguments[33],
+        register_panel:         arguments[34],
+        register_tab:           arguments[35],
+        registration_form:      arguments[36],
+        registration_request:   arguments[37],
+        requesting_contact:     arguments[38],
+        requesting_contacts:    arguments[39],
+        room_description:       arguments[40],
+        room_item:              arguments[41],
+        room_panel:             arguments[42],
+        roster:                 arguments[43],
+        roster_item:            arguments[44],
+        search_contact:         arguments[45],
+        select_option:          arguments[46],
+        status_option:          arguments[47],
+        toggle_chats:           arguments[48],
+        toolbar:                arguments[49],
+        trimmed_chat:           arguments[50]
     };
 });

+ 5 - 0
src/templates/chatroom_form.html

@@ -0,0 +1,5 @@
+<div class="chatroom-form-container">
+    <form class="pure-form converse-form chatroom-form">
+        <span class="spinner centered"/>
+    </form>
+</div>