Showing
8 changed files
with
84 additions
and
20 deletions
| ... | @@ -6,5 +6,6 @@ Homestead.yaml | ... | @@ -6,5 +6,6 @@ Homestead.yaml |
| 6 | .idea | 6 | .idea |
| 7 | /public/plugins | 7 | /public/plugins |
| 8 | /public/css | 8 | /public/css |
| 9 | +/public/js/all* | ||
| 9 | /public/bower | 10 | /public/bower |
| 10 | /storage/images | 11 | /storage/images |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -78,7 +78,10 @@ Route::group(['middleware' => 'auth'], function() { | ... | @@ -78,7 +78,10 @@ Route::group(['middleware' => 'auth'], function() { |
| 78 | Route::get('/pages/search/all', 'PageController@searchAll'); | 78 | Route::get('/pages/search/all', 'PageController@searchAll'); |
| 79 | 79 | ||
| 80 | Route::get('/', function () { | 80 | Route::get('/', function () { |
| 81 | - return view('base'); | 81 | + return view('home'); |
| 82 | + }); | ||
| 83 | + Route::get('/home', function () { | ||
| 84 | + return view('home'); | ||
| 82 | }); | 85 | }); |
| 83 | 86 | ||
| 84 | 87 | ... | ... |
| 1 | var elixir = require('laravel-elixir'); | 1 | var elixir = require('laravel-elixir'); |
| 2 | -//require('laravel-elixir-livereload'); | ||
| 3 | 2 | ||
| 4 | /* | 3 | /* |
| 5 | |-------------------------------------------------------------------------- | 4 | |-------------------------------------------------------------------------- |
| ... | @@ -13,5 +12,6 @@ var elixir = require('laravel-elixir'); | ... | @@ -13,5 +12,6 @@ var elixir = require('laravel-elixir'); |
| 13 | */ | 12 | */ |
| 14 | 13 | ||
| 15 | elixir(function(mix) { | 14 | elixir(function(mix) { |
| 16 | - mix.sass('styles.scss');//.livereload(); | 15 | + mix.sass('styles.scss'); |
| 16 | + mix.babel('image-manager.js'); | ||
| 17 | }); | 17 | }); | ... | ... |
resources/assets/js/image-manager.js
0 → 100644
| 1 | + | ||
| 2 | +class ImageList extends React.Component { | ||
| 3 | + | ||
| 4 | + constructor(props) { | ||
| 5 | + super(props); | ||
| 6 | + this.state = { | ||
| 7 | + images: [], | ||
| 8 | + hasMore: false, | ||
| 9 | + page: 0 | ||
| 10 | + }; | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | + componentDidMount() { | ||
| 14 | + $.getJSON('/images/all', data => { | ||
| 15 | + this.setState({ | ||
| 16 | + images: data.images, | ||
| 17 | + hasMore: data.hasMore | ||
| 18 | + }); | ||
| 19 | + }); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + loadMore() { | ||
| 23 | + this.state.page++; | ||
| 24 | + $.getJSON('/images/all/' + this.state.page, data => { | ||
| 25 | + this.setState({ | ||
| 26 | + images: this.state.images.concat(data.images), | ||
| 27 | + hasMore: data.hasMore | ||
| 28 | + }); | ||
| 29 | + }); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + render() { | ||
| 33 | + var images = this.state.images.map(function(image) { | ||
| 34 | + return ( | ||
| 35 | + <div key={image.id}> | ||
| 36 | + <img src={image.thumbnail}/> | ||
| 37 | + </div> | ||
| 38 | + ); | ||
| 39 | + }); | ||
| 40 | + return ( | ||
| 41 | + <div className="image-list"> | ||
| 42 | + {images} | ||
| 43 | + <div className="load-more" onClick={this.loadMore}>Load More</div> | ||
| 44 | + </div> | ||
| 45 | + ); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +class ImageManager extends React.Component { | ||
| 51 | + render() { | ||
| 52 | + return ( | ||
| 53 | + <div id="image-manager"> | ||
| 54 | + <ImageList/> | ||
| 55 | + </div> | ||
| 56 | + ); | ||
| 57 | + } | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +React.render( | ||
| 61 | + <ImageManager />, | ||
| 62 | + document.getElementById('container') | ||
| 63 | +); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -9,7 +9,7 @@ | ... | @@ -9,7 +9,7 @@ |
| 9 | border-radius: 4px; | 9 | border-radius: 4px; |
| 10 | box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.3); | 10 | box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.3); |
| 11 | overflow: hidden; | 11 | overflow: hidden; |
| 12 | - .image-manager-display img { | 12 | + .image-list img { |
| 13 | border-radius: 0; | 13 | border-radius: 0; |
| 14 | float: left; | 14 | float: left; |
| 15 | margin: 1px; | 15 | margin: 1px; |
| ... | @@ -36,34 +36,23 @@ | ... | @@ -36,34 +36,23 @@ |
| 36 | pointer-events: none; | 36 | pointer-events: none; |
| 37 | } | 37 | } |
| 38 | } | 38 | } |
| 39 | -.image-manager-left { | 39 | +.image-manager-display-wrap { |
| 40 | - background-color: #FFF; | ||
| 41 | - height: 100%; | ||
| 42 | - width: 100%; | ||
| 43 | - text-align: left; | ||
| 44 | - position: relative; | ||
| 45 | - .image-manager-display-wrap { | ||
| 46 | height: 100%; | 40 | height: 100%; |
| 47 | padding-top: 87px; | 41 | padding-top: 87px; |
| 48 | position: absolute; | 42 | position: absolute; |
| 49 | top: 0;width: 100%; | 43 | top: 0;width: 100%; |
| 50 | - } | 44 | +} |
| 51 | - .image-manager-display { | 45 | +.image-manager-display { |
| 52 | height: 100%; | 46 | height: 100%; |
| 53 | width: 100%; | 47 | width: 100%; |
| 54 | text-align: left; | 48 | text-align: left; |
| 55 | overflow-y: scroll; | 49 | overflow-y: scroll; |
| 56 | - } | ||
| 57 | - .image-manager-header { | ||
| 58 | - z-index: 50; | ||
| 59 | - position: relative; | ||
| 60 | - } | ||
| 61 | } | 50 | } |
| 62 | 51 | ||
| 63 | #image-manager .load-more { | 52 | #image-manager .load-more { |
| 64 | width: 150px; | 53 | width: 150px; |
| 65 | height: 150px; | 54 | height: 150px; |
| 66 | - display: none; | 55 | + display: block; |
| 67 | float: left; | 56 | float: left; |
| 68 | text-align: center; | 57 | text-align: center; |
| 69 | background-color: #888; | 58 | background-color: #888; | ... | ... |
| ... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
| 10 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> | 10 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> |
| 11 | <script src="/bower/bootstrap/dist/js/bootstrap.js"></script> | 11 | <script src="/bower/bootstrap/dist/js/bootstrap.js"></script> |
| 12 | <script src="/bower/jquery-sortable/source/js/jquery-sortable.js"></script> | 12 | <script src="/bower/jquery-sortable/source/js/jquery-sortable.js"></script> |
| 13 | + <script src="https://fb.me/react-0.13.3.js"></script> | ||
| 13 | <script> | 14 | <script> |
| 14 | $.fn.smoothScrollTo = function() { | 15 | $.fn.smoothScrollTo = function() { |
| 15 | if(this.length === 0) return; | 16 | if(this.length === 0) return; |
| ... | @@ -62,5 +63,7 @@ | ... | @@ -62,5 +63,7 @@ |
| 62 | </section> | 63 | </section> |
| 63 | 64 | ||
| 64 | @yield('bottom') | 65 | @yield('bottom') |
| 66 | + | ||
| 67 | + <script src="/js/all.js"></script> | ||
| 65 | </body> | 68 | </body> |
| 66 | </html> | 69 | </html> | ... | ... |
-
Please register or sign in to post a comment