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

Angular #24

Closed
wants to merge 47 commits into from
Closed

Angular #24

wants to merge 47 commits into from

Conversation

OmgImAlexis
Copy link
Collaborator

Proposed changes in this pull request:

  • Remove layout/main.mako

  • Add index.mako as default route, this will wrap all other routes and act as layouts/main.mako

  • Add angular and the needed deps

  • 404s now return { "status": 404 } instead of rendering the 404.mako file

  • hometablesorter can be added to any home layout table to have tablesorter load on it, e.g. <table tablesorter ng-repeat="showList in showLists">

  • Redirects are changing from return self.redirect('/home') to

    return {
        "status": 200,
        "redirect": {
            "ui-state": "home",
            "url": "/home"
        }
    }
    

    with state being the ui-state that needs to be loaded or url being the url it needs to redirect to. For external links it's best to use the url parameter and for internal links use ui-state as that means angular can handle it without needing to know the base-url.

  • anon-href="http://example.com" should be used instead of href="${anon_url('http://example.com')"

TODO:
  • Add config POST routes for saving
  • Add inline indications when a field is changed (e.g. field gets tinted red)
  • Add inline indications when an action is triggered (e.g. clicking save tints changed fields to green)
  • Move all base routes to angular routes
  • Convert routes to JSON and remove mako
    • Add meta values to index or new route
    • Convert templates to use angular
    • Add REST post methods to replace forms
  • Move all menus to the main index def
  • Table sorter
    • Fix .nowrap in tablesorter
    • Either change tablesorter into Angular service/directive or find a replacement
  • Remove unneeded whitespace
  • Fix Currently there is no indication when a show has a per season exception #50

@OmgImAlexis
Copy link
Collaborator Author

I need a Python dev to add in /internal/FUNCTION_HERE so we can have JSON for the angular routes. I need things like myShowList from home.mako as JSON so angular can bind it to the template. @pymedusa/developers

@OmgImAlexis OmgImAlexis mentioned this pull request Feb 27, 2016
@OmgImAlexis OmgImAlexis self-assigned this Feb 28, 2016
@p0psicles
Copy link
Contributor

@OmgImAlexis can you describe the TODO comments, for how you want them as references for you in python, html/mako and js code?

For ex: for html:

js:
// @todo: Angular

python:
'# @todo: Angular

@OmgImAlexis
Copy link
Collaborator Author

As long as it's a comment with @TODO: then the plugin I use for Atom will pick it up, same goes for @NOTE:.

Python's commenting is #, JS is // and HTML is <!-- -->.

@OmgImAlexis
Copy link
Collaborator Author

@labrys do you know how we can avoid needing a json.loads here? Some of the time it returns JSON and sometimes it's returns a string with JSON inside of it.

return json.loads(json.JSONEncoder().encode({
    "status": 200,
    "redirect": {
        "ui-state": "home",
        "url": "/home"
    }
}))

@Hellowlol
Copy link
Contributor

@OmgImAlexis all dicts could be returned as json with tornado so unless you have changed the default behaviour you should just pass it as dict.

return {
        "status": 200,
        "redirect": {
            "ui-state": "home",
            "url": "/home"
            }
        }

@OmgImAlexis
Copy link
Collaborator Author

@Hellowlol that works a lot better, thanks for that.

Edit: Just noticed we get TypeError: expected string or buffer for some of the routes so looks like we still need the JSON.encode for some of them.
Edit2: Actually don't worry about that seems I had missed removing a json.loads() and now it's all working. 👍

@OmgImAlexis
Copy link
Collaborator Author

For some reason $('.tablesorter').trigger('update'); needs to be called after the page is loaded for the tablesorter's filter to work, @Mottie any idea what's causing this?

@Mottie
Copy link

Mottie commented Mar 10, 2016

If you are using the combined widgets file (jquery.tablesorter.widgets.js) then it might be because the UMD wrapper doesn't list tablesorter as a required module. There is an open issue about this with which I could use help.

And while I am happy you guys are using my fork of tablesorter, I recently found this Angular UI Grid package which might be a better fit for your project. It doesn't have any dependencies, and I think they did a really nice job on it.

@labrys labrys added this to the Angular milestone Mar 29, 2016
@p0psicles p0psicles modified the milestones: 1.0.0, Angular May 19, 2016
@labrys labrys modified the milestones: 1.0.0, Angular May 20, 2016
@OmgImAlexis
Copy link
Collaborator Author

@pymedusa/developers Closing this as we're changing how the angular branch will be done.
I've discussed with a few members about converting page by page instead of a full redo like this as it became too big to handle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants