Project

General

Profile

« Previous | Next » 

Revision 53594

1. update_db.js: Add 'addDefaultHtmlToHtmlPagesForCommunity()' function for adding hmtl contents (/about and /organizations routes) to 'Clarin' community.
2. CommunityController.java: Add htmlPageContents when a community is created | delete htmlPageContents, statistics, communitySubscribers when a community is deleted.

View differences:

CommunityController.java
9 9
import org.springframework.web.bind.annotation.*;
10 10
import org.springframework.beans.factory.annotation.Autowired;
11 11

  
12
import javax.swing.text.html.HTML;
12 13
import java.util.*;
13 14

  
14 15
@RestController
......
35 36
    private DivHelpContentController divHelpContentController;
36 37

  
37 38
    @Autowired
39
    private HtmlPageContentController htmlPageContentController;
40

  
41
    @Autowired
38 42
    private DivIdController divIdController;
39 43

  
40 44
    @Autowired
......
232 236
            divHelpContentController.insertOrUpdateDivHelpContent(new DivHelpContent(link_metadata, id, link_metadata_content, false));
233 237
        }
234 238

  
239
        Page page = null;
240
        page = pageDAO.findByRoute("/about" );
241
        if(page != null) {
242
            String htmlContent = "<div><div class=\"uk-article-title custom-article-title\"> About the community </div> <p> This is an introductory text. To be updated... </p> </div>";
243
            HtmlPageContent htmlPageContent = new HtmlPageContent(page.getId(), id, htmlContent);
244
            htmlPageContentController.updateHtmlPageContent(htmlPageContent);
245
        }
246

  
247
        page = pageDAO.findByRoute("/organizations");
248
        if(page != null) {
249
            String htmlContent = "<div><div class=\"uk-article-title custom-article-title\"> Organizations related to the community </div> <p> This is an introductory text. Here follows the list of organizations... </p> <div class=\"uk-child-width-1-3@m uk-text-center uk-grid-match \" uk-grid > <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"https://upload.wikimedia.org/wikipedia/el/2/2b/Logo_uoa_blue.png\" alt=\"\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"https://www.uoa.gr/\">University of Athens</a> </h3> </div> </div> <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"https://pbs.twimg.com/profile_images/631127495933165569/ElbqhHK0_400x400.jpg\" alt=\"\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"https://www.athena-innovation.gr/en\">Athena Research & Innovation center</a> </h3> </div> </div> <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"\" alt=\"Logo 1\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"\">Organization 1</a> </h3> </div> </div> <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"\" alt=\"Logo 2\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"\">Organization 2</a> </h3> </div> </div> <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"\" alt=\"Logo 3\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"\">Organization 3</a> </h3> </div> </div> </div></div>";
250
            HtmlPageContent htmlPageContent = new HtmlPageContent(page.getId(), id, htmlContent);
251
            htmlPageContentController.updateHtmlPageContent(htmlPageContent);
252
        }
253

  
235 254
        return communityResponse;
236 255
    }
237 256

  
......
284 303
                pageHelpContentController.deletePageHelpContent(pageHelpContentResponse.getId());
285 304
            }
286 305

  
306
            List<HtmlPageContent> htmlPageContents = htmlPageContentController.getHtmlPageContents(pid, null);
307
            for(HtmlPageContent htmlPageContent : htmlPageContents) {
308
                htmlPageContentController.deleteHtmlPageContent(htmlPageContent.getId());
309
            }
310

  
311
            Statistics stats = statisticsDAO.findByPid(pid);
312
            if(stats != null) {
313
                statisticsDAO.delete(stats.getId());
314
            }
315

  
316
            CommunitySubscribers communitySubscribers = communitySubscribersDAO.findByPid(pid);
317
            if(communitySubscribers != null) {
318
                communitySubscribersDAO.delete(communitySubscribers.getId());
319
            }
320

  
287 321
            communityDAO.delete(id);
288 322
        }
289 323

  

Also available in: Unified diff