Parcourir la source

Fix: Create page handler

Sotaro KARASAWA il y a 9 ans
Parent
commit
30c2628e6d
2 fichiers modifiés avec 3 ajouts et 26 suppressions
  1. 0 15
      lib/views/modal/create_page.html
  2. 3 11
      resource/js/crowi.js

+ 0 - 15
lib/views/modal/create_page.html

@@ -44,21 +44,6 @@
         <hr>
         {% endif  %}
 
-        {#
-        <form class="form-horizontal" id="create-page-form" role="form">
-          <fieldset>
-            <div class="col-xs-12">
-            </div>
-            <div class="col-xs-10">
-              <input type="text" class="form-control" name="" placeholder="ページ名を入力">
-            </div>
-            <div class="col-xs-2">
-              <button type="submit" class="btn btn-primary">作成</button>
-            </div>
-          </fieldset>
-        </form>
-        #}
-
       </div><!-- /.modal-body -->
 
     </div><!-- /.modal-content -->

+ 3 - 11
resource/js/crowi.js

@@ -219,17 +219,6 @@ $(function() {
     $('#create-page-today .form-control.page-today-input2').css({width: newWidth}).focus();
 
   });
-  $('#create-page-form').submit(function(e) {
-    var name = $('input', this).val();
-    if (name === '') {
-      name = '/';
-    }
-    if (!name.match(/^\//)) {
-      name = '/' + name;
-    }
-    top.location.href = name;
-    return false;
-  });
 
   $('#create-page-today').submit(function(e) {
     var prefix1 = $('input.page-today-input1', this).data('prefix');
@@ -251,6 +240,9 @@ $(function() {
     if (!name.match(/^\//)) {
       name = '/' + name;
     }
+    if (name.match(/.+\/$/)) {
+      name = name.substr(0, name.length - 1);
+    }
     top.location.href = name;
     return false;
   });