From e3997a1a48fc991abb5f3dfb534e596ce66ee9ac Mon Sep 17 00:00:00 2001 From: Edin Dazdarevic Date: Sun, 25 Jan 2015 14:04:10 +0100 Subject: [PATCH] more reorganization --- .DS_Store | Bin 6148 -> 6148 bytes back-office/.DS_Store | Bin 0 -> 6148 bytes front-api/.DS_Store | Bin 6148 -> 6148 bytes front-ui/.DS_Store | Bin 6148 -> 6148 bytes front-ui/app/.DS_Store | Bin 6148 -> 6148 bytes front-ui/app/app.js | 9 - front-ui/app/components/.DS_Store | Bin 0 -> 6148 bytes .../app/components/browsing/byCategory.js | 14 +- front-ui/app/components/items/.DS_Store | Bin 0 -> 6148 bytes .../app/components/{ => items}/allItems.js | 6 +- .../app/components/{ => items}/itemList.js | 2 +- .../{ => items}/itemMultiMediaDescriptions.js | 0 front-ui/app/components/items/itemPage.js | 2 +- .../{ => items}/itemWithDetailsPage.js | 6 +- front-ui/app/components/items/singleItem.js | 31 ++++ front-ui/app/components/rootApp.js | 2 +- .../app/components/sectionsListComponent.js | 172 ------------------ front-ui/app/components/shared/.DS_Store | Bin 0 -> 6148 bytes .../shared/sectionsListComponent.js | 115 ++++++++++++ front-ui/app/components/singleItem.js | 32 ---- .../app/components/startPage/startPage.js | 2 +- front-ui/app/externalApi.js | 9 + front-ui/app/rapp.js | 36 ---- front-ui/app/ribica.js | 8 +- front-ui/app/routes.js | 29 +++ 25 files changed, 205 insertions(+), 270 deletions(-) create mode 100644 back-office/.DS_Store delete mode 100644 front-ui/app/app.js create mode 100644 front-ui/app/components/.DS_Store create mode 100644 front-ui/app/components/items/.DS_Store rename front-ui/app/components/{ => items}/allItems.js (80%) rename front-ui/app/components/{ => items}/itemList.js (90%) rename front-ui/app/components/{ => items}/itemMultiMediaDescriptions.js (100%) rename front-ui/app/components/{ => items}/itemWithDetailsPage.js (92%) create mode 100644 front-ui/app/components/items/singleItem.js delete mode 100644 front-ui/app/components/sectionsListComponent.js create mode 100644 front-ui/app/components/shared/.DS_Store create mode 100644 front-ui/app/components/shared/sectionsListComponent.js delete mode 100644 front-ui/app/components/singleItem.js create mode 100644 front-ui/app/externalApi.js delete mode 100644 front-ui/app/rapp.js create mode 100644 front-ui/app/routes.js diff --git a/.DS_Store b/.DS_Store index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..e6781fab99fb38c65de244453b3b9033d462ebb7 100644 GIT binary patch literal 6148 zcmeH~L2uJA6vv;pY)dwfdO_NPFW|k3x`m32o6YSowNf(kSv2ngrsUydZ?-e z5aRprIXEM}P5D3jAX+l?coW^0~BXA zL%lL99uNDH^*!!q>97ofpK5L0+1T82-EH^Q*=d?5#kgIJ@?`k3+bhQ1G`WbQ!7J^T zQ8^m6qk-;u5tTjkX#b=rGWcf_eVQg^?{(weWYXMk1;MW0Y#p?wyZ+?x5DyOzg6Y)r zT(9xXy>ox>(bJRYvikJ-i~i-Luv=-nE&4~k!dXG%V|S2eMg9&Eob6$k8(_D~sRXr% z`jjs4`hh6swIRHgWL$ezOXjq|$(`dgTBM|oh0>-_s>NS>Mzt9&5c24lj_5IU=s9$c zK2S3MPg1{_(M%h>t20>z?#|T>X-BdIEP)$BfcFOg88zvoT;%@9S_&srbl4GJ5_RYr9RDmjj|!$AjHu~2NHo+1YW5HK<@2y7PQ5M$Y_z%h$?Gdl-A2T%b}u84%9H(hI5x+KtY8KJ$3PAT diff --git a/back-office/.DS_Store b/back-office/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..074206a2b1d3393460b0339626310392fa1e8f21 GIT binary patch literal 6148 zcmeHKK~BRk5FC@Lw17m99CPGUi64Zj1##d~J^)Dzs+u-cX%WXfgGccIegm_%g<==3 z6+*j`J&8SQk0(uB12BW_7k#X;jWRx> zi~~%Nha8B`w}#F`Tw{ubRZwCYu|;o_eG;;%qNM%;^Dxh9Z{{WB&0;M^^v0|z_CXYz zPD62`-fUKpjvAz8#S7 zL&_qUd8{4UPX{Y|1R%E9Y=hVK&p$Dh24d#1cE}cnaj8U?YWxwy__Kp?>Fm!uzjo-- zVeHHt$Iop13B~xMhe<6RCUdB@I-m}O4kYfjC;R{C_w#?4q<89oI`FR?Fs(}Cve%|8_bd{^s~y@DR(?CS7qS(fvDjc=Di_4eW9^VF4E-ZuZO}>`*sB9yqF%(g literal 0 HcmV?d00001 diff --git a/front-api/.DS_Store b/front-api/.DS_Store index 6880bbc063bdb1296ecb9723fa8c7b3bee6e4a19..359b89e8f13d8a05ed886e99b5632ee5c84f725e 100644 GIT binary patch literal 6148 zcmeHKK~BRk5FD4Pv=pRrr~N+phY29M$a{03%igW@Dy zQH6FZdt7_R>zy=q4Zuvc*%>eb&}R|s9K(le|b8-rAuG zr~8CZj^Z`;7c*GqZaNo*!uQ86B4DyzEWz;pJ=2%wt z48}C`+6>K@+ZyAe#u)mTFU+W51jb-%6S8b>Z6)w$4LRDUm5ehDEN&l8KOuv#w;QPH)?#~!fg9TQcM4p~# z()PreaWLHgbIfp#DXxiQE+nfhmd`6-h%9QmuYmj}X#Jr>tyKY4Ko$5=K=y}-MKJbQ zI<#8{D|-bXcG+!>Z8Cn+({N=;=$j0AL zjE&CuBkK+mJJebgPz6E-_T1Nzod2`m@Bbl5zo`PMz`s(!bf-7d2~+ZCYa=;1Ya^Ch q7BTTF9a;)2e;nI}9K|Or);JbPgBW`(9kPd}e*~-yTB!nms=ybeP^{$u delta 106 zcmZoMXfc=|#>CJzu~2NHo}vg70|Nsi1A_oVQht68kj=oxkUOzZW3qt=3ojEx3PVy# zadHkwZt^Ww+07yx!YmsbteH2nbMSKj4cRQn@tt`xzlbg;&n+a diff --git a/front-ui/.DS_Store b/front-ui/.DS_Store index 450365b30c90b8b625faca173f5789fb1e280903..04afe536c3d80071403b836a12a9910b1c321d5a 100644 GIT binary patch literal 6148 zcmeHKO>fgc5PjRE;FKcef`rtI#i@rja#NvRID{xIa6m#$r5-3Mb{!gnv7^`~hbY2; z5PyN+!SCRV_&4G02U3lT#0ep~Bh9|qota(Fv)1bcAo@kP1GE7+REfORdR@ z8IevQ=Sa_jI1Sj7(^;_$SO)%e2ISstz{doWM{#BU9?-K%70ab6!bAnLY+`o#mtYb{ zS?+n?#7d*NdhNR7tU2o^$59fdvwm76VfJ)5PG`d?90mULnX+>~FS5QrRh}n)KBh<6 zM`;?ajtm6Tuj7^Z^ zg~}MAgO|vvdE&5^mmo!m5l-=1Sp`=c)$+dA@+N#gXL!Z-obhTc<|ozlAm7*L3(wiY zA@*?}13V^nxaMV*UCiJFR;~~OW|ufOu29XkRLg*6;LjM4-v^f}v1hQgS*6$^l}}V5yNK6rodzI#rk}hA?*rq0{N_nfOwpPKQt{a~`v@FgFxot{%cw z;SfEIwzUjc2C57+bhjB)qu~2NHo}wrd0|Nsi1A_oVaY0f}eiD#(C#hg#;c~{w1|lpv%nXSP z1q=mA<;b!*nZ+dr1~(X)m|0la*f}`4fRK-$b8;DrT77hIMt*rnVp3RUYI(eXh;x2k zNn&PRY7s~{I5QDh37ln(r2|D6Hw$uzu}o~ZyP2JXp92^&K>l~;$^0UY93YKA!&o*)h^%1- E06z0iNdN!< diff --git a/front-ui/app/.DS_Store b/front-ui/app/.DS_Store index ca70ab55f9d1135d1550fad4528a0e88135c5594..69e3a4e6452476d7ab4182dc74073f186345c54e 100644 GIT binary patch literal 6148 zcmeHKL2uJA6n<{IEiEwhf`r5+;IJA`T=xFI@e2ZkVNsx>IoRg+Srsv>|8 ze__9a-@zI2Z_4*2f<*h7&K~w}-N|SfIXv6HJp)5G&62U=&A5+G_n2m1=Ek zd&hAa&h5*KXc)?AM^1)e^0GUS({2>@1AqKVwNpQxBprXOMxOiW03)h>j!eGqUakWDK;%4U7d{{04Nqj^Q%sM*kLZxz7T(8PUcuUG1+U;QDNwwmjH6cl z8l0-(Y~w4D$g>ZoIWU&F37&O6w>ol)5Iw?N{Icjg8{y;>V1}fLnonsyteN05t+L98 zS3!c;FXV$S_K)bGZHAc-*txYC)3LL#3RngHq5`}>xG0RC!AzstI#8)A0I-H`WoYxC z2Ija1J%gD>jKGAZ0yR~bD~8Z?^t;B-Gni@AbQ0$BAdTY|Hn7q|JPXd(JEjS*dzr+?W}v&!Hmq=T9_N3wJypV6gKwDG%5-za~!J% fU##w-D8rb`4WMT*(}*6J{Ue}cu$5KdpDOShtB%+x delta 91 zcmZoMXfc=|#>CJzu~2NHo}wrt0|NsP3otO`GvqN8rxYjWB;`*mRA*$IY{eqCS%gEF qWn+UE^JaDqeh#3n&4L`?nJ4p$=yHNI9spv7$u>OFn`1~L2nCP*n=yYn9@dKrZlNNlwwrG zzrw43fEWK0|DE;wW}eU=>&1hp%qwrcFEj5o%!kZOLPV-FN%x6bMC8F)8%;Fl7>~2B z*@pD^P-Xt3q>Kt0JjwOTwQSen2si?N8v$Os9wjs;O;cJ}ze%nWjPb_s1%3m5^Xv>Q z(H2&DMSXfrC9m{_%q~XnU^95Io|#O`kz{^NMtN3NVfbBbY&N#GFL++lyL5Vz6{((f z^rT43r@f(`_Oi5}#N%fsuHtG^cH*%aIf|9=_ZD)a^K$=rj!QFN zA?brkWvEni1RYR+g-r%Fx8a|K4MJzXNkE=`R|c*LL?hAKDn?++mO^c*l1~g}%h4Z5UL;yuwdJJDo$)_%XC+@K%G@3O zfl0?9YSp!lfFrO>VAEc<`22tL>+k>NB6sBoI0F9_0oCaCx*beO&epZb@mU+dU%=To nueNGR(8zIY0zQhb!i`}p-~bwl)>hF2b1wo0gKHdtKT6;SmA|pz literal 0 HcmV?d00001 diff --git a/front-ui/app/components/browsing/byCategory.js b/front-ui/app/components/browsing/byCategory.js index 3ea5e97..9dc54c4 100644 --- a/front-ui/app/components/browsing/byCategory.js +++ b/front-ui/app/components/browsing/byCategory.js @@ -1,13 +1,13 @@ var React = require('react'); var ByCategory = React.createClass({ - render: function() { - return ( -
-

Browse products by category

-
- ); - } + render: function() { + return ( +
+

Browse products by category

+
+ ); + } }); module.exports = ByCategory; diff --git a/front-ui/app/components/items/.DS_Store b/front-ui/app/components/items/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a9a49cbe71ad6dbb9aef2150d952c1ac55f07e36 GIT binary patch literal 6148 zcmeHK%}T>S5T2<;Dn;l?ya+jZ5`2SDqEN6PdhlxhsF7&Ir1w0A59I^+Hu}x%5YjgF zSVU&R>^HkRGduYbvRNYH;c9+KG$5iLRIqb|rbT34bW1umatLJ2QPP55sGtja-tzW= zzsP_*yFN`Q!!@Gj^D9PKKAUFw6dv+=Ttm;lRbWX}YW_E{3fS`0H={n``O%0vtE0xW z!kQ)eW4twU;Di!b1DAt+w#@DI+#=HwnOf@MJJi#RI;rbuV#|G5k~1yF}!oX0xRV<+8~N61g}7&VVzpM+UHGi}d;dy>$kh0cW6QK)w$V zR4_KI0_vv&jUEAjT@0(hmY+q5i40@IDj;Sc972I1lhJBf3^GkzaHd0XTTZwR}64Bxle|;CEHuKZcg^v s2>J*W5x**69RfqQV))8dd;cq9feHmm|-1mZseN`p7fz+M^n0j!a4bpQYW literal 0 HcmV?d00001 diff --git a/front-ui/app/components/allItems.js b/front-ui/app/components/items/allItems.js similarity index 80% rename from front-ui/app/components/allItems.js rename to front-ui/app/components/items/allItems.js index 38565a8..282b3b8 100644 --- a/front-ui/app/components/allItems.js +++ b/front-ui/app/components/items/allItems.js @@ -1,8 +1,8 @@ var React = require('react'); var ItemList = require('./itemList'); -var ItemStore = require('../stores/itemStore.js'); -var ItemActions = require('../actions/itemActions.js'); -var ItemCollection = require('../models/itemCollection'); +var ItemStore = require('../../stores/itemStore.js'); +var ItemActions = require('../../actions/itemActions.js'); +var ItemCollection = require('../../models/itemCollection'); var AllItems = React.createClass({ diff --git a/front-ui/app/components/itemList.js b/front-ui/app/components/items/itemList.js similarity index 90% rename from front-ui/app/components/itemList.js rename to front-ui/app/components/items/itemList.js index 46531fd..5f01bcb 100644 --- a/front-ui/app/components/itemList.js +++ b/front-ui/app/components/items/itemList.js @@ -1,6 +1,6 @@ var React = require('react'); var SingleItem = require('./singleItem'); -var ItemCollection = require('../models/itemCollection.js'); +var ItemCollection = require('../../models/itemCollection.js'); var ItemList = React.createClass({ diff --git a/front-ui/app/components/itemMultiMediaDescriptions.js b/front-ui/app/components/items/itemMultiMediaDescriptions.js similarity index 100% rename from front-ui/app/components/itemMultiMediaDescriptions.js rename to front-ui/app/components/items/itemMultiMediaDescriptions.js diff --git a/front-ui/app/components/items/itemPage.js b/front-ui/app/components/items/itemPage.js index 4ae8c25..954cbc0 100644 --- a/front-ui/app/components/items/itemPage.js +++ b/front-ui/app/components/items/itemPage.js @@ -1,5 +1,5 @@ var React = require('react') - ItemWithDetailsPage = require('../itemWithDetailsPage'); + ItemWithDetailsPage = require('./itemWithDetailsPage'); var ItemPage = React.createClass({ render: function() { return ( diff --git a/front-ui/app/components/itemWithDetailsPage.js b/front-ui/app/components/items/itemWithDetailsPage.js similarity index 92% rename from front-ui/app/components/itemWithDetailsPage.js rename to front-ui/app/components/items/itemWithDetailsPage.js index 0c8fe41..8f13493 100644 --- a/front-ui/app/components/itemWithDetailsPage.js +++ b/front-ui/app/components/items/itemWithDetailsPage.js @@ -1,9 +1,9 @@ var React = require('react'), ItemMultiMediaDescriptions = require('./itemMultiMediaDescriptions'), - ItemActions = require('../actions/itemActions'), - ItemStore = require('../stores/itemStore'); + ItemActions = require('../../actions/itemActions'), + ItemStore = require('../../stores/itemStore'); -var Item = require('../models/item'); +var Item = require('../../models/item'); var Router = require('react-router'); var Navigation = Router.Navigation; diff --git a/front-ui/app/components/items/singleItem.js b/front-ui/app/components/items/singleItem.js new file mode 100644 index 0000000..f9ee8f8 --- /dev/null +++ b/front-ui/app/components/items/singleItem.js @@ -0,0 +1,31 @@ +var React = require('react'); +var ItemActions = require('../../actions/itemActions'); + +var Router = require('react-router'); +var Navigation = Router.Navigation; + +var SingleItem = React.createClass({ + mixins: [Navigation], + render: function() { + var self = this; + var itemClick = this.itemClick; + var firstImage = this.props.item.get('multi_media_descriptions')[0]; + firstImage = firstImage || { url: "http://res.cloudinary.com/lfvt7ps2n/image/upload/c_crop,g_center,w_300/v1421732950/http_www.asms.ru_bitrix_templates_main_images_nophoto_irnofq.png" } ; + return ( +
+ +

{ this.props.item.get('name') }

+
{ this.props.item.get('list_price') } KM
+
+ ); + }, + + itemClick: function(e) { + // no need for this to go through ItemActions + //ItemActions.selectItem(this.props.item); + this.transitionTo('/artikal/' + this.props.item.get('id') +'/' + this.props.item.get('name')); + } +}); + + +module.exports = SingleItem; diff --git a/front-ui/app/components/rootApp.js b/front-ui/app/components/rootApp.js index 780748a..55a9425 100644 --- a/front-ui/app/components/rootApp.js +++ b/front-ui/app/components/rootApp.js @@ -1,5 +1,5 @@ var React = require('react'), - SectionsListComponent = require('./sectionsListComponent'), + SectionsListComponent = require('./shared/sectionsListComponent'), Router = require('react-router'), RouteHandler = Router.RouteHandler; diff --git a/front-ui/app/components/sectionsListComponent.js b/front-ui/app/components/sectionsListComponent.js deleted file mode 100644 index 50291a9..0000000 --- a/front-ui/app/components/sectionsListComponent.js +++ /dev/null @@ -1,172 +0,0 @@ -var React = require('react'), - SectionCollection = require('../models/sectionCollection'), - Section = require('../models/section'), - Backbone = require('backbone'); - -var Navigation = require('react-router').Navigation; - -Backbone.$ = $; - -var SectionsListComponent = React.createClass({ - mixins : [Navigation], - getInitialState: function() { - return { - sections : [], - hoveredSection : '' - }; - }, - componentDidMount: function() { - var sections = new SectionCollection(); - sections.fetch({success: function() { - console.log('Loaded sections:' , sections); - if(this.isMounted()) { - this.setState({ - sections: sections.models - }); - } - - - }.bind(this)}); - }, - onMouseOver: function(section) { - //console.log('mouse over!', section); - - this.setState({ - hoveredSection: section.get('id') - }); - }, - onMouseOut: function() { - this.setState({ - hoveredSection : '' - }); - }, - onSectionClick: function(section) { - //alert('clicked on section:'+ section.get('name')); - this.transitionTo('/sekcija/'+ section.get('id') + '/' + section.get('name')); - this.setState({ - hoveredSection : '' - }); - - return false; - }, - onCategoryClick: function(category, section) { - - this.transitionTo('/sekcija/' + section.get('name') +'/kategorija/'+ category.id + '/' + category.name); - this.setState({ - hoveredSection: '' - }); - console.log('category', category.id); - return false; - }, - onSubcategoryClick: function(subcategory) { - - return false; - }, - render: function() { - var self = this; - var style = { - position: 'relative' - }; - var abStyle = { - position: 'absolute' - }; - return ( -
-
    - {this.state.sections.map(function(section) { - return ( -
  • - - { section.get('name') } - -
    - -
      - {section.get('categories').map(function(category) { - return ( -
    • - {category.name} -
        - {category.sub_categories.map(function(subCategory) { - - return ( -
      • - - {subCategory.name}
      • - - ) - })} - -
      -
    • - ) - })} -
    -
    -
  • - ) - })} -
-
- ); - } -}); -/* -var SectionItem = React.createClass({ - subCatClicked: function() { - alert('you clicked on subcategory'); - }, - render: function() { - var catStyle = { - paddingLeft: '20px' - }; - var subStyle = { - paddingLeft: '20px' - }; - - var style = { - paddingLeft: '30px' - }; - var self = this; - - return ( -
  • - - {this.props.data.get('name')} -
    - { - this.props.data.get('categories').map(function(cat) { - return (
    {cat.name} - - - { cat.sub_categories.map(function(sc) { - return
    {sc.name}
    - }) } -
    ) - }) - } -
    -
  • - ); - } -}); - -var SectionsListComponent = React.createClass({ - render: function() { - return ( -
    - -
      - {this.props.sections.models.map(function(s){ - return - })} - - -
    -
    - ); - } -}); -*/ - -module.exports = SectionsListComponent; diff --git a/front-ui/app/components/shared/.DS_Store b/front-ui/app/components/shared/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1938026054e582c15274886df37d18e1cd53d705 GIT binary patch literal 6148 zcmeHKF-`+P3>-s>NHi%^Zb^m24^AN|km&dTN=N|;T%-&Ab@?2Bg0a0IPA3o*1sY4< z+4Xt6xhc*u09(A=Ujj1#Q@SILzKqSEyN~RoMvO>jjR&-NMu!{jerL{|ld;7HhXKFi z`HJfg70#ZN75hX+XqHrBQmu{{mUPBT&1)+5 ziAjgW&8$;zwmP9$+|GE3bXb$9RSHOfp#rCQoO%CW(Z8Ahha{b(fE4&w3fN?MyIk;< zYHuCAocG#7zoUN`b0eKgv|?hkVjjE|&%fjq-}8A>u}=&-<3T6tkAUkUlLCLCz&l2@ BAv*v7 literal 0 HcmV?d00001 diff --git a/front-ui/app/components/shared/sectionsListComponent.js b/front-ui/app/components/shared/sectionsListComponent.js new file mode 100644 index 0000000..fac18ff --- /dev/null +++ b/front-ui/app/components/shared/sectionsListComponent.js @@ -0,0 +1,115 @@ +var React = require('react'), + SectionCollection = require('../../models/sectionCollection'), + Section = require('../../models/section'), + Backbone = require('backbone'); + +var Navigation = require('react-router').Navigation; + +Backbone.$ = $; + +var SectionsListComponent = React.createClass({ + mixins : [Navigation], + getInitialState: function() { + return { + sections : [], + hoveredSection : '' + }; + }, + componentDidMount: function() { + var sections = new SectionCollection(); + sections.fetch({success: function() { + console.log('Loaded sections:' , sections); + if(this.isMounted()) { + this.setState({ + sections: sections.models + }); + } + + + }.bind(this)}); + }, + onMouseOver: function(section) { + //console.log('mouse over!', section); + + this.setState({ + hoveredSection: section.get('id') + }); + }, + onMouseOut: function() { + this.setState({ + hoveredSection : '' + }); + }, + onSectionClick: function(section) { + //alert('clicked on section:'+ section.get('name')); + this.transitionTo('/sekcija/'+ section.get('id') + '/' + section.get('name')); + this.setState({ + hoveredSection : '' + }); + + return false; + }, + onCategoryClick: function(category, section) { + + this.transitionTo('/sekcija/' + section.get('name') +'/kategorija/'+ category.id + '/' + category.name); + this.setState({ + hoveredSection: '' + }); + console.log('category', category.id); + return false; + }, + onSubcategoryClick: function(subcategory) { + + return false; + }, + render: function() { + var self = this; + var style = { + position: 'relative' + }; + var abStyle = { + position: 'absolute' + }; + return ( +
    +
      + {this.state.sections.map(function(section) { + return ( +
    • + + { section.get('name') } + +
      + +
        + {section.get('categories').map(function(category) { + return ( +
      • + {category.name} +
          + {category.sub_categories.map(function(subCategory) { + + return ( +
        • + + {subCategory.name}
        • + + ) + })} + +
        +
      • + ) + })} +
      +
      +
    • + ) + })} +
    +
    + ); + } +}); + +module.exports = SectionsListComponent; diff --git a/front-ui/app/components/singleItem.js b/front-ui/app/components/singleItem.js deleted file mode 100644 index 2cfba7c..0000000 --- a/front-ui/app/components/singleItem.js +++ /dev/null @@ -1,32 +0,0 @@ -var React = require('react'); -var ItemActions = require('../actions/itemActions'); - -var Router = require('react-router'); -var Navigation = Router.Navigation; - - -var SingleItem = React.createClass({ - mixins: [Navigation], - render: function() { - var self = this; - var itemClick = this.itemClick; - var firstImage = this.props.item.get('multi_media_descriptions')[0]; - firstImage = firstImage || { url: "http://res.cloudinary.com/lfvt7ps2n/image/upload/c_crop,g_center,w_300/v1421732950/http_www.asms.ru_bitrix_templates_main_images_nophoto_irnofq.png" } ; - return ( -
    - -

    { this.props.item.get('name') }

    -
    { this.props.item.get('list_price') } KM
    -
    - ); - }, - - itemClick: function(e) { - // no need for this to go through ItemActions - //ItemActions.selectItem(this.props.item); - this.transitionTo('/artikal/' + this.props.item.get('id') +'/' + this.props.item.get('name')); - } -}); - - -module.exports = SingleItem; diff --git a/front-ui/app/components/startPage/startPage.js b/front-ui/app/components/startPage/startPage.js index bbd692d..689a944 100644 --- a/front-ui/app/components/startPage/startPage.js +++ b/front-ui/app/components/startPage/startPage.js @@ -1,7 +1,7 @@ var React = require('react'), Router = require('react-router'), RouteHandler = Router.RouteHandler, - AllItems = require('../allItems'); + AllItems = require('../items/allItems'); var StartPage = React.createClass({ render : function() { diff --git a/front-ui/app/externalApi.js b/front-ui/app/externalApi.js new file mode 100644 index 0000000..4d03ec6 --- /dev/null +++ b/front-ui/app/externalApi.js @@ -0,0 +1,9 @@ +var App = function() { + this.bootstrap = function() { + // here goes all app initialization and bootstraping logic + // nothing at the moment + }; +}; + +var app = new App(); +module.exports = app; diff --git a/front-ui/app/rapp.js b/front-ui/app/rapp.js deleted file mode 100644 index 67cb2c5..0000000 --- a/front-ui/app/rapp.js +++ /dev/null @@ -1,36 +0,0 @@ -var React = require('react'); -var Router = require('react-router'), - Route = Router.Route, DefaultRoute = Router.DefaultRoute; -var RouteHandler = Router.RouteHandler; -var Navigation = Router.Navigation; - - -var ItemWithDetailsPage = require('./components/itemWithDetailsPage'); -var ItemList = require('./components/itemList'); -var SectionsListComponent = require('./components/sectionsListComponent'); -var AllItems = require('./components/allItems'); -var RootApp = require('./components/rootApp'); -var StartPage = require('./components/startPage/startPage'); -var ByCategory = require('./components/browsing/byCategory'); -var BySection = require('./components/browsing/bySection'); - -var ItemPage = require('./components/items/itemPage'); - - -var routes = ( - - - - - - - - - - - - ); - -Router.run(routes, function(Handler) { - React.render(, document.body); -}); diff --git a/front-ui/app/ribica.js b/front-ui/app/ribica.js index e2a380f..c4aa540 100644 --- a/front-ui/app/ribica.js +++ b/front-ui/app/ribica.js @@ -1,9 +1,9 @@ var Backbone = require('backbone'); -var app = require('./app'); -var rapp = require('./rapp'); +var ExternalApi = require('./externalApi'); +var Routes = require('./routes'); Backbone.$ = $; module.exports = { - App : app, - RApp: rapp + ExternalApi: ExternalApi, + Routes : Routes } diff --git a/front-ui/app/routes.js b/front-ui/app/routes.js new file mode 100644 index 0000000..d2420ec --- /dev/null +++ b/front-ui/app/routes.js @@ -0,0 +1,29 @@ +var React = require('react'); +var Router = require('react-router'), + Route = Router.Route, DefaultRoute = Router.DefaultRoute; +var RouteHandler = Router.RouteHandler; +var Navigation = Router.Navigation; + +var ItemWithDetailsPage = require('./components/items/itemWithDetailsPage'); +var ItemList = require('./components/items/itemList'); +var SectionsListComponent = require('./components/shared/sectionsListComponent'); +var AllItems = require('./components/items/allItems'); +var RootApp = require('./components/rootApp'); +var StartPage = require('./components/startPage/startPage'); +var ByCategory = require('./components/browsing/byCategory'); +var BySection = require('./components/browsing/bySection'); + +var ItemPage = require('./components/items/itemPage'); + +var routes = ( + + + + + + + ); + +Router.run(routes, function(Handler) { + React.render(, document.body); +});