easywebhub / tasks

List of tasks for EasyWeb members
1 stars 4 forks source link

xử dụng firebase hiện thực chức năng comment #35

Open tungptvn opened 7 years ago

tungptvn commented 7 years ago

dựa theo task

baotnq commented 7 years ago

em thêm mô tả cho việc này nghe, càng đầy đủ chi tiết càng tốt.

baotnq commented 7 years ago

sử dụng Electron build apps để test với firebase, dựa theo source code https://coligo.io/bookmarking-app-electron-vuejs-firebase/

tungptvn commented 7 years ago

firebase acct : (cấu hình thông tin ở global.json)

in global.json "firebaseInfo" :


    {
    apiKey: "AIzaSyBa6fkK-ECMH75rWwIxrWRUjeB9VtM5m54",
    authDomain: "tungpt-app1.firebaseapp.com",
    databaseURL: "https://tungpt-app1.firebaseio.com",
    storageBucket: "tungpt-app1.appspot.com",
    messagingSenderId: "423706317172"
    config_website : {
        "enable-pageview" : true/false, 
        "partial" : [
            "page_view_counter.html": true,
            "like_counter.html": true,
            "comment_block":false
        ]

    }
   }```

## partial  : bao gồm code html và code javavasript :  vue+ firebase.
  - "page_view_counter.html" :
    {#if config_website.enable-pageview  }
       <div> getPageView() </div>
     <script>
        var getPageView = call Ajaxt to get pageview; 
    </script>       
    {/if}

  - "page_view_counter-list.html" :
    var enable = page_view_counter || public-key != null

    {#if enable}
       <div> getPageView(id_page) </div>
     <script>
        var enable = page_view_counter || public-key != null
    </script>       
    {/if}
  - "like_counter.html"
  - "comment_block.html" 

<!--định nghĩa trong partial-->

firebase-script-partial.html

<script src="https://www.gstatic.com/firebasejs/3.6.4/firebase.js"></script>
<script>
  // Initialize Firebase
  var config = {
    apiKey: "AIzaSyBa6fkK-ECMH75rWwIxrWRUjeB9VtM5m54",
    authDomain: "tungpt-app1.firebaseapp.com",
    databaseURL: "https://tungpt-app1.firebaseio.com",
    storageBucket: "tungpt-app1.appspot.com",
    messagingSenderId: "423706317172"
  };
  firebase.initializeApp(config);
</script>