-
Notifications
You must be signed in to change notification settings - Fork 19
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
Reorganize static file structure and display revision data to user #16
Conversation
a22b53b
to
c8444c7
Compare
Looks good so far. What is Back over to you |
The last commit adds support for layouts and fixes some issues with how I was using Semantic UI. I will fully explain in the PR section when finished! Also |
f270b1a
to
10aab82
Compare
Still haven't actually styled the revision page, just did all behind the scenes work to include sass and materialize. I've written a small novel in READMEs so please do check them out :D (there are 4 or so in total in this PR). BTW the final PR will be more organized in terms of commits and so on. Getting there! |
c2e902a
to
d71264a
Compare
@@ -0,0 +1,3 @@ | |||
.Footer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep selectors as lowercase, especially if we're using -
to separate selector words instead of camelcase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you see the static/src/css/README.md
? They start with uppercase letters because of the SUIT CSS pattern discussed there (meant to allow us to have components for all our stuff, sorta like we did in React).
landoui/static/src/js/lando.js
Outdated
@@ -0,0 +1,2 @@ | |||
// Setup one global namespace to hold all our classes. | |||
var Lando = Lando || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can run into a runtime error with this; instead put window
in:
window.Lando = window.Lando || {};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
landoui/static/src/css/colors.scss
Outdated
@@ -0,0 +1,13 @@ | |||
// In dev, you must make a change in lando.scss for changes here to be detected. | |||
// This file isn't autowatched by the Flask asset pipeline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do something about this? Initiate a watcher of some kind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can :)
@@ -73,8 +69,10 @@ def create_app( | |||
|
|||
# Register routes via Flask Blueprints | |||
from landoui.pages import pages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity: why are we pulling these in here instead of at the top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really not that I think of it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes actually! It is because these depend on the global oidc variable we set at the top.
@@ -0,0 +1,33 @@ | |||
/* Simple class to manage events and state on the /revision/{id} page */ | |||
Lando.RevisionPage = class { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In looking at how this is used, we should really use the jQuery plugin pattern. You can find an example I created for MDN here:
https://github.com/mozilla/kuma/blob/master/kuma/static/js/moz-jquery-plugins.js#L287
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean we should create 1 plugin for the entire 1 "RevisionPage" or a plugin for the collapsible that I made?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it I'll update this to use the pattern for the whole page e.g.$page.landoRevisionPage()
.
Also doing so will probably remove the need for the global Lando variable I made (maybe it wouldn't hurt to keep it)
This isn't building properly:
|
b48e03b
to
ad186ca
Compare
ff7be65
to
7828cc1
Compare
landoui/assets_src/js/README.md
Outdated
} | ||
|
||
bindEvents(){ | ||
$('button').click(clickHandler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use .on('click', clickHandler)
landoui/assets_src/js/README.md
Outdated
### Example Class for the widget above | ||
|
||
```javascript | ||
Lando.Widget = class { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, is any of this documentation current?
landoui/assets_src/js/lando.js
Outdated
@@ -0,0 +1,2 @@ | |||
// Setup one global namespace to hold all our classes. | |||
window.Lando = window.Lando || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer needed.
function RevisionPageCollapsible(){ | ||
let $revision = $(this).closest('.RevisionPage-parentRevision').first(); | ||
|
||
$(this).click(function(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.on('click', fn)
$page.find('.RevisionPage-collapseLink').landoRevisionPageCollapsible(); | ||
} | ||
|
||
return this.each(RevisionPage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RevisionPage
is so small we can probably just inline it. Also, only classes should be capitalized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be $(this).each()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.each I believe
landoui/revisions.py
Outdated
|
||
@revisions.route('/revisions/<revision_id>') | ||
def get_revision(revision_id): | ||
revision_api_url = os.getenv('LANDO_API_URL') + '/revisions/' + revision_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do:
{API_URL}/revisions/{REVISION_ID}'.format(...)
?
7828cc1
to
46585fe
Compare
const iconClassSelectors = '.fa-chevron-circle-right, .fa-chevron-circle-down'; | ||
const iconClassToggle = 'fa-chevron-circle-right, fa-chevron-circle-down'; | ||
|
||
return this.each(function(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$(this).each
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty sure it is this.each, since this already refers to the jquery selector.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and it works so far)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ready to go after nits
display: none; | ||
margin-top: .5rem; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: empty lines, also later at the endo of the file
color: $blue; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: empty lines
landoui/revisions.py
Outdated
@revisions.route('/revisions/<revision_id>') | ||
def get_revision(revision_id): | ||
revision_api_url = '{}/revisions/{}'\ | ||
.format(os.getenv('LANDO_API_URL'), revision_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: wouldn't it be better to write it like this?
'{}/revisions/{}'.format(
os.getenv('LANDO_API_URL'), revision_id
)
46585fe
to
280b317
Compare
280b317
to
deb69b8
Compare
Fixed, gonna merge it :) |
Update: I've split the patch into smaller commits that have self contained commits.
See the "Document changes" patch with a lot of readme information.
To test this patch, you will have to start the lando-api docker image then in this projects
docker-compose
file edit theLANDO_API_URL
to point to the docker-ip address:port of lando api.It will help greatly to look at the structure of this PR in your file editor for it to make more sense.
============================================================
[wip] I will update the screenshot as I push more changes.