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

Directory Middleware Improvements: #968

Closed
wants to merge 3 commits into from
Closed

Conversation

simov
Copy link
Contributor

@simov simov commented Dec 2, 2013

More information about this pull request: #734

Features

  • details and mobile views
  • include icon images only once from css

Details

  • The new option is called view and defaults to tiles
.use(connect.directory('/root', {icons:true, view:'details'))
  • The iconStyle function means css styles for the icons and is responsible for embedding the icons inside the document only once. Right now each image is pushed 3 times for each view respectively because the initial idea was to have dynamic view change and icon size.
  • The icons in the mobile view need to be 32x32 px, that's why they are looking too small at the moment, if the 16x16 images is stretched to 32px they look blurred. Other than that the css is just copy/pasted. I haven't changed anything in the default styles, just a little bit cleanup here and there, the bottom of the file contains the new styles.
  • The html function is responsible only for generating the html, the images are added inside iconStyle. The changes are just a bunch of html tags + classes for styling.

- details and mobile views
- include icon images only once from css
@ghost ghost assigned dougwilson Dec 2, 2013
@@ -109,7 +110,7 @@ exports = module.exports = function directory(root, options){

// not acceptable
if (!type) return next(utils.error(406));
exports[mediaType[type]](req, res, files, next, originalDir, showUp, icons, path);
exports[mediaType[type]](req, res, files, next, originalDir, showUp, icons, path, view);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow. lol

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from being a function with 9 parameters, what's wrong with this line?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol that's it. we need to refactor that eventually

@@ -1,5 +1,10 @@
body {
* {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way you can make this something other than a star selector?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a quick way to nullify all browser specific styles. I used this in a lot of sites so far and I didn't saw any problems with it. I don't know how it benchmarks but it's definitely not something that you will notice.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i don't have a problem with this either since it really does apply to all elements. i do this as well because figuring out the browser's default margins and paddings and fixing them is a pain in the ass. if he was doing something like .parent > * then that would be a different issue.

@jonathanong
Copy link
Contributor

@simov is this a newer, better version of the previous PR? if so, can you close the other one?

@simov
Copy link
Contributor Author

simov commented Dec 4, 2013

I think so, directory first and sorting was added by @dougwilson and the rest is here. What's missing is a bunch of icons and more importantly their 32x32px versions, so the code responsible for embedding different icon sizes into the document was removed too. I'm closing the other one, there is a link to it at the top of this page.

@jonathanong
Copy link
Contributor

i don't have any more comments, so it's up to you @dougwilson now.

@dougwilson
Copy link
Contributor

Right. It seems good. I'm going to pull it to double-check it later today and then should be good to merge.

@jonathanong
Copy link
Contributor

@dougwilson i guess someone forgot :(

@dougwilson
Copy link
Contributor

@jonathanong thanks for the reminder :) I already looked at it, so going to marge it now into master since it is backwards-compatible.

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

Successfully merging this pull request may close these issues.

None yet

3 participants