Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refresh] 3 (possible) bugs #115

Closed
astockwell opened this issue Feb 3, 2013 · 3 comments
Closed

[Refresh] 3 (possible) bugs #115

astockwell opened this issue Feb 3, 2013 · 3 comments

Comments

@astockwell
Copy link

First off, I'm pretty new to RoR, but have been a longtime php dev, so I'm submitting these as "possible" bugs, since I may not fully grasp how the app functions or may have a missed a config step, etc.

Love the project and your work, as I downloaded the refresh branch and have been playing with it, I've noticed 3 bugs.

  1. At /admin, When you begin typing your "idea" (title), and you arrive at /new, once the page attempts to save (via js), rails throws a route error:
    ActionController::RoutingError (No route matches [PUT] "/3/edit")

The fix is in edit.js, the path is incorrect:

--- a/app/assets/javascripts/admin/edit.js
+++ b/app/assets/javascripts/admin/edit.js
@@ -191,7 +191,7 @@ function savePost(callback) {

       // If we just finished creating a new post
       if (!state.post) {
-        setFormAction('/edit/' + data.id);
+        setFormAction('/' + data.id);
         setFormMethod('put');
       }
  1. Once that's fixed, if you
    1. repeat those steps again (goto /admin, begin typing new post title, routed to /new),
    2. then type some more so it registers and saves your post,
    3. then press the "back" button at the top of the left navigation column to return to /admin,
    4. wait a few seconds with the js console open, and ...

Javascript will throw an error and silently stop working. I've gotten it to throw two different errors:
Cannot call method 'removeClass' of undefined on line 187 of admin/edit.js
and
Cannot call method 'addClass' of undefined ... save on line 171 of admin/edit.js (which I assume save is the el.save obj).

Unfortunately I haven't dug in enough to understand the event flow and thus how to fix these.

  1. In the content editor the 'Return' key doesn't work, no way to insert a new line!

The fix is in keyboard.js:

--- a/app/assets/javascripts/admin/keyboard.js
+++ b/app/assets/javascripts/admin/keyboard.js
@@ -83,10 +83,11 @@ $(window)
       switch (e.which) {
         // Enter
         case 13:
-          if (!state.beganEditing) {
-            e.preventDefault();
-            el.content.focus();
-          }
+          break;
         // Cmd
         case 91:
           key.cmd = true;

I searched the project and it doesn't look like the beganEditing property is being used anywhere (again, unless I'm missing something), so I removed the preventDefault.

Please let me know if this is helpful at all, or if I'm off base. I can submit pull req's for #'s 1 and 3 if it would help.

@natew
Copy link
Owner

natew commented Feb 11, 2013

Thanks for these. Going to look into them tonight and push some stuff up. Feel free to send a pull request as well.

@astockwell
Copy link
Author

No worries, I will try to get a pull request together tonight as well.

P.S. I believe this also fixes Issue #81

@natew
Copy link
Owner

natew commented Mar 17, 2013

Still need to look into the error, but marking this closed for now

@natew natew closed this as completed Mar 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants