Refactor website with new design & structure
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
//-
|
||||
//- Crafting Guide - browse_page.jade
|
||||
//-
|
||||
//- Copyright © 2014-2016 by Redwood Labs
|
||||
//- All rights reserved.
|
||||
//-
|
||||
|
||||
.content.view__browse_page
|
||||
.left
|
||||
.view__adsense
|
||||
|
||||
.right
|
||||
.tile_container
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Crafting Guide - browse_page.scss
|
||||
//
|
||||
// Copyright © 2014-2016 by Redwood Labs
|
||||
// All rights reserved.
|
||||
//
|
||||
|
||||
.view__browse_page {
|
||||
@include layout-body-with-sidebar;
|
||||
|
||||
.right {
|
||||
.tile_container {
|
||||
display : flex;
|
||||
flex-wrap : wrap;
|
||||
justify-content : space-between;
|
||||
|
||||
.view__mod_tile {
|
||||
max-width : calc(50% - 12px); // $size-margin-large / 2
|
||||
margin-bottom : $size-margin-large;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# Crafting Guide - browse_page_controller.coffee
|
||||
#
|
||||
# Copyright © 2014-2016 by Redwood Labs
|
||||
# All rights reserved.
|
||||
#
|
||||
|
||||
AdsenseController = require '../common/adsense/adsense_controller'
|
||||
ModTileController = require './mod_tile/mod_tile_controller'
|
||||
PageController = require '../page_controller'
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
module.exports = class BrowsePageController extends PageController
|
||||
|
||||
constructor: (options={})->
|
||||
if not options.modPack then throw new Error 'options.modPack is required'
|
||||
options.templateName = 'browse_page'
|
||||
super options
|
||||
|
||||
@_modPack = options.modPack
|
||||
@_tileControllers = []
|
||||
|
||||
# PageController Overrides #####################################################################
|
||||
|
||||
getTitle: ->
|
||||
return "Browse"
|
||||
|
||||
# BaseController Overrides #####################################################################
|
||||
|
||||
onDidRender: ->
|
||||
@_adsenseController = @addChild AdsenseController, '.view__adsense', model:'skyscraper'
|
||||
|
||||
@$tileContainer = @$('.tile_container')
|
||||
|
||||
refresh: ->
|
||||
@_refreshModTiles()
|
||||
super
|
||||
|
||||
# Backbone.View Overrides ######################################################################
|
||||
|
||||
events: ->
|
||||
return _.extend super,
|
||||
'click a': 'routeLinkClick'
|
||||
|
||||
# Private Methods ##############################################################################
|
||||
|
||||
_refreshModTiles: ->
|
||||
index = 0
|
||||
mods = @_modPack.getAllMods()
|
||||
for mod in mods
|
||||
controller = @_tileControllers[index]
|
||||
if not controller
|
||||
controller = new ModTileController model:mod, router:@router
|
||||
controller.render()
|
||||
@$tileContainer.append controller.$el
|
||||
@_tileControllers.push controller
|
||||
else
|
||||
controller.model = mod
|
||||
index++
|
||||
|
||||
while @_tileControllers.length > mods.length
|
||||
controller = @_tileControllers.pop()
|
||||
controller.remove()
|
||||
@@ -0,0 +1,14 @@
|
||||
//-
|
||||
//- Crafting Guide - mod_tile.jade
|
||||
//-
|
||||
//- Copyright © 2014-2016 by Redwood Labs
|
||||
//- All rights reserved.
|
||||
//-
|
||||
|
||||
.view__mod_tile
|
||||
a
|
||||
.left
|
||||
img
|
||||
.right
|
||||
p.title
|
||||
p.description
|
||||
@@ -0,0 +1,88 @@
|
||||
//
|
||||
// Crafting Guide - mod_tile.scss
|
||||
//
|
||||
// Copyright © 2014-2016 by Redwood Labs
|
||||
// All rights reserved.
|
||||
//
|
||||
|
||||
.view__mod_tile {
|
||||
min-width : $size-minecraft-block * 9;
|
||||
|
||||
display : flex;
|
||||
justify-content : stretch;
|
||||
align-items : stretch;
|
||||
|
||||
a {
|
||||
max-width: 100%;
|
||||
|
||||
@include floating-panel;
|
||||
border : $size-border-medium solid $color-background-panel;
|
||||
color : $color-text;
|
||||
text-decoration : none;
|
||||
|
||||
display : flex;
|
||||
padding : $size-margin-medium;
|
||||
|
||||
& > .left {
|
||||
flex: 0 0 $size-minecraft-block * 4;
|
||||
margin-right: $size-margin-medium;
|
||||
|
||||
img {
|
||||
width: $size-minecraft-block * 4;
|
||||
max-height: $size-minecraft-block * 4;
|
||||
}
|
||||
}
|
||||
|
||||
& > .right {
|
||||
flex : 1 1 100%;
|
||||
|
||||
overflow : hidden;
|
||||
|
||||
.title {
|
||||
margin-bottom : $size-margin-medium;
|
||||
|
||||
font-family : $font-family-header;
|
||||
font-size : $font-size-xlarge;
|
||||
}
|
||||
|
||||
.description {
|
||||
font-family : $font-family-text;
|
||||
font-size : $font-size-medium;
|
||||
line-height : $font-size-medium * 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: $color-blue-faint;
|
||||
border-color: $color-link-normal;
|
||||
|
||||
& > .right {
|
||||
.title {
|
||||
color: $color-link-normal;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
a {
|
||||
& > .left {
|
||||
img {
|
||||
@include grayscale;
|
||||
opacity: 0.25;
|
||||
}
|
||||
}
|
||||
|
||||
& > .right {
|
||||
.title {
|
||||
color: $color-gray-light;
|
||||
}
|
||||
|
||||
.description {
|
||||
color: $color-gray-light;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# Crafting Guide - mod_tile_controller.coffee
|
||||
#
|
||||
# Copyright © 2014-2016 by Redwood Labs
|
||||
# All rights reserved.
|
||||
#
|
||||
|
||||
BaseController = require '../../base_controller'
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
module.exports = class ModTileController extends BaseController
|
||||
|
||||
constructor: (options={})->
|
||||
options.templateName = 'browse_page/mod_tile'
|
||||
super options
|
||||
|
||||
# BaseController Overrides #####################################################################
|
||||
|
||||
onDidRender: ->
|
||||
@$link = @$('a')
|
||||
@$logoImage = @$('img')
|
||||
@$title = @$('p.title')
|
||||
@$description = @$('p.description')
|
||||
super
|
||||
|
||||
refresh: ->
|
||||
@$link.attr 'href', c.url.mod modSlug:@model.slug
|
||||
@$logoImage.attr 'src', c.url.modIcon modSlug:@model.slug
|
||||
@$title.text @model.name
|
||||
@$description.text @model.description
|
||||
|
||||
if @model.enabled
|
||||
@$el.removeClass 'disabled'
|
||||
else
|
||||
@$el.addClass 'disabled'
|
||||
|
||||
super
|
||||
|
||||
# Backbone.View Overrides ######################################################################
|
||||
|
||||
events: ->
|
||||
_.extend super,
|
||||
'click a': 'routeLinkClick'
|
||||
Reference in New Issue
Block a user